-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbase_authentication_method.go
66 lines (64 loc) · 2.5 KB
/
base_authentication_method.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package models
type BaseAuthenticationMethod int
const (
PASSWORD_BASEAUTHENTICATIONMETHOD BaseAuthenticationMethod = iota
VOICE_BASEAUTHENTICATIONMETHOD
HARDWAREOATH_BASEAUTHENTICATIONMETHOD
SOFTWAREOATH_BASEAUTHENTICATIONMETHOD
SMS_BASEAUTHENTICATIONMETHOD
FIDO2_BASEAUTHENTICATIONMETHOD
WINDOWSHELLOFORBUSINESS_BASEAUTHENTICATIONMETHOD
MICROSOFTAUTHENTICATOR_BASEAUTHENTICATIONMETHOD
TEMPORARYACCESSPASS_BASEAUTHENTICATIONMETHOD
EMAIL_BASEAUTHENTICATIONMETHOD
X509CERTIFICATE_BASEAUTHENTICATIONMETHOD
FEDERATION_BASEAUTHENTICATIONMETHOD
UNKNOWNFUTUREVALUE_BASEAUTHENTICATIONMETHOD
)
func (i BaseAuthenticationMethod) String() string {
return []string{"password", "voice", "hardwareOath", "softwareOath", "sms", "fido2", "windowsHelloForBusiness", "microsoftAuthenticator", "temporaryAccessPass", "email", "x509Certificate", "federation", "unknownFutureValue"}[i]
}
func ParseBaseAuthenticationMethod(v string) (any, error) {
result := PASSWORD_BASEAUTHENTICATIONMETHOD
switch v {
case "password":
result = PASSWORD_BASEAUTHENTICATIONMETHOD
case "voice":
result = VOICE_BASEAUTHENTICATIONMETHOD
case "hardwareOath":
result = HARDWAREOATH_BASEAUTHENTICATIONMETHOD
case "softwareOath":
result = SOFTWAREOATH_BASEAUTHENTICATIONMETHOD
case "sms":
result = SMS_BASEAUTHENTICATIONMETHOD
case "fido2":
result = FIDO2_BASEAUTHENTICATIONMETHOD
case "windowsHelloForBusiness":
result = WINDOWSHELLOFORBUSINESS_BASEAUTHENTICATIONMETHOD
case "microsoftAuthenticator":
result = MICROSOFTAUTHENTICATOR_BASEAUTHENTICATIONMETHOD
case "temporaryAccessPass":
result = TEMPORARYACCESSPASS_BASEAUTHENTICATIONMETHOD
case "email":
result = EMAIL_BASEAUTHENTICATIONMETHOD
case "x509Certificate":
result = X509CERTIFICATE_BASEAUTHENTICATIONMETHOD
case "federation":
result = FEDERATION_BASEAUTHENTICATIONMETHOD
case "unknownFutureValue":
result = UNKNOWNFUTUREVALUE_BASEAUTHENTICATIONMETHOD
default:
return nil, nil
}
return &result, nil
}
func SerializeBaseAuthenticationMethod(values []BaseAuthenticationMethod) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i BaseAuthenticationMethod) isMultiValue() bool {
return false
}