2015-03-30 19:30:27 +00:00
|
|
|
package providers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/bitly/go-simplejson"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Provider interface {
|
|
|
|
Data() *ProviderData
|
|
|
|
GetEmailAddress(auth_response *simplejson.Json,
|
|
|
|
access_token string) (string, error)
|
2015-05-13 01:48:13 +00:00
|
|
|
ValidateToken(access_token string) bool
|
2015-03-30 19:30:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func New(provider string, p *ProviderData) Provider {
|
|
|
|
switch provider {
|
2015-03-31 19:17:17 +00:00
|
|
|
case "myusa":
|
|
|
|
return NewMyUsaProvider(p)
|
2015-04-17 22:33:17 +00:00
|
|
|
case "linkedin":
|
|
|
|
return NewLinkedInProvider(p)
|
2015-03-30 19:30:27 +00:00
|
|
|
default:
|
|
|
|
return NewGoogleProvider(p)
|
|
|
|
}
|
|
|
|
}
|