add BackendLogoutAllSessionsURL configuration

This commit is contained in:
Anderson Valério 2024-12-27 08:37:43 -03:00
parent a9ac8d5496
commit fb64fad321
No known key found for this signature in database
GPG Key ID: 92D38E56BFF005A0
4 changed files with 10 additions and 0 deletions

View File

@ -545,6 +545,8 @@ type LegacyProvider struct {
AllowedRoles []string `flag:"allowed-role" cfg:"allowed_roles"`
BackendLogoutURL string `flag:"backend-logout-url" cfg:"backend_logout_url"`
BackendLogoutAllSessionsURL string `flag:"backend-logout-all-sessions-url" cfg:"backend_logout_all_sessions_url"`
AcrValues string `flag:"acr-values" cfg:"acr_values"`
JWTKey string `flag:"jwt-key" cfg:"jwt_key"`
JWTKeyFile string `flag:"jwt-key-file" cfg:"jwt_key_file"`
@ -613,6 +615,7 @@ func legacyProviderFlagSet() *pflag.FlagSet {
flagSet.StringSlice("allowed-group", []string{}, "restrict logins to members of this group (may be given multiple times)")
flagSet.StringSlice("allowed-role", []string{}, "(keycloak-oidc) restrict logins to members of these roles (may be given multiple times)")
flagSet.String("backend-logout-url", "", "url to perform a backend logout, {id_token} can be used as placeholder for the id_token")
flagSet.String("backend-logout-all-sessions-url", "", "url to perform a backend logout, {user_id} can be used as placeholder for the user_id")
return flagSet
}
@ -693,6 +696,8 @@ func (l *LegacyProvider) convert() (Providers, error) {
AllowedGroups: l.AllowedGroups,
CodeChallengeMethod: l.CodeChallengeMethod,
BackendLogoutURL: l.BackendLogoutURL,
BackendLogoutAllSessionsURL: l.BackendLogoutAllSessionsURL,
}
// This part is out of the switch section for all providers that support OIDC

View File

@ -88,6 +88,8 @@ type Provider struct {
// URL to call to perform backend logout, `{id_token}` would be replaced by the actual `id_token` if available in the session
BackendLogoutURL string `json:"backendLogoutURL"`
BackendLogoutAllSessionsURL string `json:"backendLogoutAllSessionsURL"`
}
// ProviderType is used to enumerate the different provider type options

View File

@ -60,6 +60,8 @@ type ProviderData struct {
loginURLParameterOverrides map[string]*regexp.Regexp
BackendLogoutURL string
BackendLogoutAllSessionsURL string
}
// Data returns the ProviderData

View File

@ -163,6 +163,7 @@ func newProviderDataFromConfig(providerConfig options.Provider) (*ProviderData,
p.setAllowedGroups(providerConfig.AllowedGroups)
p.BackendLogoutURL = providerConfig.BackendLogoutURL
p.BackendLogoutAllSessionsURL = providerConfig.BackendLogoutAllSessionsURL
return p, nil
}