mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2024-11-28 09:08:44 +02:00
23 lines
539 B
Go
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)
|
|
}
|
|
}
|