change var name

This commit is contained in:
Tao Chen 2024-05-09 16:02:23 +02:00
parent 890d6e73fb
commit 51a257b700

View file

@ -662,7 +662,7 @@ func PrefixV6() (*netip.Prefix, error) {
func GetOIDCConfig() (OIDCConfig, error) { func GetOIDCConfig() (OIDCConfig, error) {
// get expiry config // get expiry config
expireConfig := OIDCExpireConfig{ oidcExpireConfig := OIDCExpireConfig{
FromToken: viper.GetBool("oidc.expiry.from_token"), FromToken: viper.GetBool("oidc.expiry.from_token"),
FixedTime: func() time.Duration { FixedTime: func() time.Duration {
// if set to 0, we assume no expiry // if set to 0, we assume no expiry
@ -681,20 +681,20 @@ func GetOIDCConfig() (OIDCConfig, error) {
}(), }(),
} }
// get allowed config // get allowed config
allowedConfig := OIDCAllowedConfig{ oidcAllowed := OIDCAllowedConfig{
Domains: viper.GetStringSlice("oidc.allowed.domains"), Domains: viper.GetStringSlice("oidc.allowed.domains"),
Users: viper.GetStringSlice("oidc.allowed.users"), Users: viper.GetStringSlice("oidc.allowed.users"),
Groups: viper.GetStringSlice("oidc.allowed.groups"), Groups: viper.GetStringSlice("oidc.allowed.groups"),
} }
// get claims map // get claims map
claimsMap := OIDCClaimsMap{ oidcClaimsMap := OIDCClaimsMap{
Name: viper.GetString("oidc.claims_map.name"), Name: viper.GetString("oidc.claims_map.name"),
Username: viper.GetString("oidc.claims_map.username"), Username: viper.GetString("oidc.claims_map.username"),
Email: viper.GetString("oidc.claims_map.email"), Email: viper.GetString("oidc.claims_map.email"),
Groups: viper.GetString("oidc.claims_map.groups"), Groups: viper.GetString("oidc.claims_map.groups"),
} }
// get misc config // get misc config
miscConfig := OIDCMiscConfig{ oidcMiscConfig := OIDCMiscConfig{
StripEmaildomain: viper.GetBool("oidc.strip_email_domain"), StripEmaildomain: viper.GetBool("oidc.strip_email_domain"),
FlattenGroups: viper.GetBool("oidc.flatten_groups"), FlattenGroups: viper.GetBool("oidc.flatten_groups"),
FlattenSplter: viper.GetString("oidc.flatten_splitter"), FlattenSplter: viper.GetString("oidc.flatten_splitter"),
@ -721,10 +721,10 @@ func GetOIDCConfig() (OIDCConfig, error) {
ClientSecret: oidcClientSecret, ClientSecret: oidcClientSecret,
Scope: viper.GetStringSlice("oidc.scope"), Scope: viper.GetStringSlice("oidc.scope"),
ExtraParams: viper.GetStringMapString("oidc.extra_params"), ExtraParams: viper.GetStringMapString("oidc.extra_params"),
Allowed: allowedConfig, Allowed: oidcAllowed,
ClaimsMap: claimsMap, ClaimsMap: oidcClaimsMap,
Expiry: expireConfig, Expiry: oidcExpireConfig,
Misc: miscConfig, Misc: oidcMiscConfig,
} }
return OIDC, nil return OIDC, nil
} }