forked from bitly/oauth2_proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
providers.go
39 lines (36 loc) · 981 Bytes
/
providers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 "github":
return NewGitHubProvider(p)
case "azure":
return NewAzureProvider(p)
<<<<<<< HEAD
case "cloudfoundry":
return NewCloudFoundryProvider(p)
=======
case "gitlab":
return NewGitLabProvider(p)
>>>>>>> Add GitLab provider
default:
return NewGoogleProvider(p)
}
}