forked from openshift/origin
/
helpers.go
39 lines (32 loc) · 1000 Bytes
/
helpers.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 config
import (
osinv1 "github.com/openshift/api/osin/v1"
)
func IsOAuthIdentityProvider(provider osinv1.IdentityProvider) bool {
switch provider.Provider.Object.(type) {
case
*osinv1.OpenIDIdentityProvider,
*osinv1.GitHubIdentityProvider,
*osinv1.GitLabIdentityProvider,
*osinv1.GoogleIdentityProvider:
return true
}
return false
}
func IsPasswordAuthenticator(provider osinv1.IdentityProvider) bool {
switch provider.Provider.Object.(type) {
case
*osinv1.BasicAuthPasswordIdentityProvider,
*osinv1.AllowAllPasswordIdentityProvider,
*osinv1.DenyAllPasswordIdentityProvider,
*osinv1.HTPasswdPasswordIdentityProvider,
*osinv1.LDAPPasswordIdentityProvider,
*osinv1.KeystonePasswordIdentityProvider,
// we explicitly only include the bootstrap type in this function
// but not IsIdentityProviderType as this is not a real IDP
// it is an implementation detail that is not surfaced to users
*BootstrapIdentityProvider:
return true
}
return false
}