oauth2_proxy/providers/providers.go
2015-05-21 02:06:23 -04:00

24 lines
457 B
Go

package providers
import (
"github.com/bitly/go-simplejson"
)
type Provider interface {
Data() *ProviderData
GetEmailAddress(auth_response *simplejson.Json,
access_token string) (string, error)
ValidateToken(access_token string) bool
}
func New(provider string, p *ProviderData) Provider {
switch provider {
case "myusa":
return NewMyUsaProvider(p)
case "linkedin":
return NewLinkedInProvider(p)
default:
return NewGoogleProvider(p)
}
}