oauth2_proxy/providers/providers.go
Jehiah Czebotar a0763477c5
Facebook Authentication Provider
* will not re-prompt if the email permission is denied, or if you previously authorized the same FB app without the email scope.
2016-06-23 08:43:21 -04:00

37 lines
924 B
Go

package providers
import (
"github.com/bitly/oauth2_proxy/cookie"
)
type Provider interface {
Data() *ProviderData
GetEmailAddress(*SessionState) (string, error)
Redeem(string, string) (*SessionState, error)
ValidateGroup(string) bool
ValidateSessionState(*SessionState) bool
GetLoginURL(redirectURI, finalRedirect string) string
RefreshSessionIfNeeded(*SessionState) (bool, error)
SessionFromCookie(string, *cookie.Cipher) (*SessionState, error)
CookieForSession(*SessionState, *cookie.Cipher) (string, error)
}
func New(provider string, p *ProviderData) Provider {
switch provider {
case "myusa":
return NewMyUsaProvider(p)
case "linkedin":
return NewLinkedInProvider(p)
case "facebook":
return NewFacebookProvider(p)
case "github":
return NewGitHubProvider(p)
case "azure":
return NewAzureProvider(p)
case "gitlab":
return NewGitLabProvider(p)
default:
return NewGoogleProvider(p)
}
}