mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 04:18:01 +00:00
1aa8c49e41
# Which Problems Are Solved Zitadel never stored or returned the requested `response_mode` in oidc Auth Requests. This caused the oidc library to fallback to the default based on the response_type. # How the Problems Are Solved - Store the `response_mode` in the Auth request repo - Store the `response_mode` in the Auth request v2 events - Return the `resonse_mode` from the Auth Request v1 and v2 `ResponseMode()` methods. (Was hard-coded to an empty string) # Additional Changes - Populate the `response_modes_supported` to the oidc Discovery Configuration. When it was empty, the standard specifies the default of `query` and `fragment`. However, our oidc library also supports `form_post` and by this fix, zitadel now also supports this. # Additional Context - Closes #6586 - Reported https://discord.com/channels/927474939156643850/1151508313717084220 --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
87 lines
2.9 KiB
Go
87 lines
2.9 KiB
Go
// Code generated by "enumer -type OIDCResponseMode -transform snake -trimprefix OIDCResponseMode"; DO NOT EDIT.
|
|
|
|
package domain
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const _OIDCResponseModeName = "unspecifiedqueryfragmentform_post"
|
|
|
|
var _OIDCResponseModeIndex = [...]uint8{0, 11, 16, 24, 33}
|
|
|
|
const _OIDCResponseModeLowerName = "unspecifiedqueryfragmentform_post"
|
|
|
|
func (i OIDCResponseMode) String() string {
|
|
if i < 0 || i >= OIDCResponseMode(len(_OIDCResponseModeIndex)-1) {
|
|
return fmt.Sprintf("OIDCResponseMode(%d)", i)
|
|
}
|
|
return _OIDCResponseModeName[_OIDCResponseModeIndex[i]:_OIDCResponseModeIndex[i+1]]
|
|
}
|
|
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
func _OIDCResponseModeNoOp() {
|
|
var x [1]struct{}
|
|
_ = x[OIDCResponseModeUnspecified-(0)]
|
|
_ = x[OIDCResponseModeQuery-(1)]
|
|
_ = x[OIDCResponseModeFragment-(2)]
|
|
_ = x[OIDCResponseModeFormPost-(3)]
|
|
}
|
|
|
|
var _OIDCResponseModeValues = []OIDCResponseMode{OIDCResponseModeUnspecified, OIDCResponseModeQuery, OIDCResponseModeFragment, OIDCResponseModeFormPost}
|
|
|
|
var _OIDCResponseModeNameToValueMap = map[string]OIDCResponseMode{
|
|
_OIDCResponseModeName[0:11]: OIDCResponseModeUnspecified,
|
|
_OIDCResponseModeLowerName[0:11]: OIDCResponseModeUnspecified,
|
|
_OIDCResponseModeName[11:16]: OIDCResponseModeQuery,
|
|
_OIDCResponseModeLowerName[11:16]: OIDCResponseModeQuery,
|
|
_OIDCResponseModeName[16:24]: OIDCResponseModeFragment,
|
|
_OIDCResponseModeLowerName[16:24]: OIDCResponseModeFragment,
|
|
_OIDCResponseModeName[24:33]: OIDCResponseModeFormPost,
|
|
_OIDCResponseModeLowerName[24:33]: OIDCResponseModeFormPost,
|
|
}
|
|
|
|
var _OIDCResponseModeNames = []string{
|
|
_OIDCResponseModeName[0:11],
|
|
_OIDCResponseModeName[11:16],
|
|
_OIDCResponseModeName[16:24],
|
|
_OIDCResponseModeName[24:33],
|
|
}
|
|
|
|
// OIDCResponseModeString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func OIDCResponseModeString(s string) (OIDCResponseMode, error) {
|
|
if val, ok := _OIDCResponseModeNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
|
|
if val, ok := _OIDCResponseModeNameToValueMap[strings.ToLower(s)]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to OIDCResponseMode values", s)
|
|
}
|
|
|
|
// OIDCResponseModeValues returns all values of the enum
|
|
func OIDCResponseModeValues() []OIDCResponseMode {
|
|
return _OIDCResponseModeValues
|
|
}
|
|
|
|
// OIDCResponseModeStrings returns a slice of all String values of the enum
|
|
func OIDCResponseModeStrings() []string {
|
|
strs := make([]string, len(_OIDCResponseModeNames))
|
|
copy(strs, _OIDCResponseModeNames)
|
|
return strs
|
|
}
|
|
|
|
// IsAOIDCResponseMode returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i OIDCResponseMode) IsAOIDCResponseMode() bool {
|
|
for _, v := range _OIDCResponseModeValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|