oauth2_proxy/providers/providers.go
2015-06-07 21:03:53 -04:00

23 lines
539 B
Go

package providers
type Provider interface {
Data() *ProviderData
GetEmailAddress(body []byte, access_token string) (string, error)
Redeem(string, string) ([]byte, string, error)
ValidateToken(access_token string) bool
GetLoginURL(redirectURI, finalRedirect string) string
}
func New(provider string, p *ProviderData) Provider {
switch provider {
case "myusa":
return NewMyUsaProvider(p)
case "linkedin":
return NewLinkedInProvider(p)
case "github":
return NewGitHubProvider(p)
default:
return NewGoogleProvider(p)
}
}