-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_authentication_mechanism_ext.go
36 lines (26 loc) · 1.41 KB
/
model_authentication_mechanism_ext.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
package jossoappi
import "fmt"
// AuthenticationMechanismDTO -> BindAuthenticationDTO+DelegatedAuthenticationDTO+AuthenticationMechanism
func (m AuthenticationMechanismDTO) ToBasicAuthn() (*BasicAuthenticationDTO, error) {
ba := NewBasicAuthenticationDTOInit()
if m.AdditionalProperties["@c"] != ba.AdditionalProperties["@c"] {
return nil, fmt.Errorf("invalid authentication mechanism java class %s", m.AdditionalProperties["@c"])
}
ba.SetName(m.GetName())
ba.SetDisplayName(m.GetDisplayName())
ba.SetPriority(m.GetPriority())
ba.SetEnabled(AsBool(m.AdditionalProperties["enabled"], false))
ba.SetHashAlgorithm(AsString(m.AdditionalProperties["hashAlgorithm"], ""))
ba.SetHashEncoding(AsString(m.AdditionalProperties["hashEncoding"], ""))
ba.SetIgnoreUsernameCase(AsBool(m.AdditionalProperties["ignoreUsernamecase"], false))
//ba.SetIgnorePasswordCase(m.AdditionalProperties["ignorePassowordCase"].(bool))
ba.SetSaltLength(AsInt32(m.AdditionalProperties["saltLength"], 0))
ba.SetSaltPrefix(AsString(m.AdditionalProperties["saltPrefix"], ""))
ba.SetSaltSuffix(AsString(m.AdditionalProperties["saltSuffix"], ""))
//authn.AdditionalProperties["impersonateUserPolicy"]
ba.SetSimpleAuthnSaml2AuthnCtxClass(AsString(m.AdditionalProperties["simpleAuthnSaml2AuthnCtxClass"], ""))
return ba, nil
}
func (m AuthenticationMechanismDTO) IsBasicAuthn() bool {
return m.AdditionalProperties["@c"] == ".BasicAuthenticationDTO"
}