Use op.SupportedClaims instead of interface
This commit is contained in:
parent
3bb48f7cba
commit
22758c3fce
5 changed files with 9 additions and 31 deletions
|
@ -47,7 +47,6 @@ type Configuration interface {
|
||||||
RequestObjectSupported() bool
|
RequestObjectSupported() bool
|
||||||
RequestObjectSigningAlgorithmsSupported() []string
|
RequestObjectSigningAlgorithmsSupported() []string
|
||||||
|
|
||||||
SupportedClaims() []string
|
|
||||||
SupportedUILocales() []language.Tag
|
SupportedUILocales() []language.Tag
|
||||||
DeviceAuthorization() DeviceAuthorizationConfig
|
DeviceAuthorization() DeviceAuthorizationConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func CreateDiscoveryConfig(ctx context.Context, config Configuration, storage Di
|
||||||
IntrospectionEndpointAuthMethodsSupported: AuthMethodsIntrospectionEndpoint(config),
|
IntrospectionEndpointAuthMethodsSupported: AuthMethodsIntrospectionEndpoint(config),
|
||||||
RevocationEndpointAuthSigningAlgValuesSupported: RevocationSigAlgorithms(config),
|
RevocationEndpointAuthSigningAlgValuesSupported: RevocationSigAlgorithms(config),
|
||||||
RevocationEndpointAuthMethodsSupported: AuthMethodsRevocationEndpoint(config),
|
RevocationEndpointAuthMethodsSupported: AuthMethodsRevocationEndpoint(config),
|
||||||
ClaimsSupported: config.SupportedClaims(),
|
ClaimsSupported: SupportedClaims(config),
|
||||||
CodeChallengeMethodsSupported: CodeChallengeMethods(config),
|
CodeChallengeMethodsSupported: CodeChallengeMethods(config),
|
||||||
UILocalesSupported: config.SupportedUILocales(),
|
UILocalesSupported: config.SupportedUILocales(),
|
||||||
RequestParameterSupported: config.RequestObjectSupported(),
|
RequestParameterSupported: config.RequestObjectSupported(),
|
||||||
|
@ -88,7 +88,7 @@ func createDiscoveryConfigV2(ctx context.Context, config Configuration, storage
|
||||||
IntrospectionEndpointAuthMethodsSupported: AuthMethodsIntrospectionEndpoint(config),
|
IntrospectionEndpointAuthMethodsSupported: AuthMethodsIntrospectionEndpoint(config),
|
||||||
RevocationEndpointAuthSigningAlgValuesSupported: RevocationSigAlgorithms(config),
|
RevocationEndpointAuthSigningAlgValuesSupported: RevocationSigAlgorithms(config),
|
||||||
RevocationEndpointAuthMethodsSupported: AuthMethodsRevocationEndpoint(config),
|
RevocationEndpointAuthMethodsSupported: AuthMethodsRevocationEndpoint(config),
|
||||||
ClaimsSupported: config.SupportedClaims(),
|
ClaimsSupported: SupportedClaims(config),
|
||||||
CodeChallengeMethodsSupported: CodeChallengeMethods(config),
|
CodeChallengeMethodsSupported: CodeChallengeMethods(config),
|
||||||
UILocalesSupported: config.SupportedUILocales(),
|
UILocalesSupported: config.SupportedUILocales(),
|
||||||
RequestParameterSupported: config.RequestObjectSupported(),
|
RequestParameterSupported: config.RequestObjectSupported(),
|
||||||
|
@ -213,7 +213,12 @@ func AuthMethodsRevocationEndpoint(c Configuration) []oidc.AuthMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SupportedClaims(c Configuration) []string {
|
func SupportedClaims(c Configuration) []string {
|
||||||
return c.SupportedClaims()
|
provider, ok := c.(*Provider)
|
||||||
|
if ok && provider.config.SupportedClaims != nil {
|
||||||
|
return provider.config.SupportedClaims
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefaultSupportedClaims
|
||||||
}
|
}
|
||||||
|
|
||||||
func CodeChallengeMethods(c Configuration) []oidc.CodeChallengeMethod {
|
func CodeChallengeMethods(c Configuration) []oidc.CodeChallengeMethod {
|
||||||
|
|
|
@ -544,11 +544,7 @@ func TestSupportedClaims(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"scopes",
|
"scopes",
|
||||||
args{func() op.Configuration {
|
args{},
|
||||||
m := mock.NewMockConfiguration(gomock.NewController(t))
|
|
||||||
m.EXPECT().SupportedClaims().Return(op.DefaultSupportedClaims)
|
|
||||||
return m
|
|
||||||
}()},
|
|
||||||
[]string{
|
[]string{
|
||||||
"sub",
|
"sub",
|
||||||
"aud",
|
"aud",
|
||||||
|
|
|
@ -358,20 +358,6 @@ func (mr *MockConfigurationMockRecorder) RevocationEndpointSigningAlgorithmsSupp
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevocationEndpointSigningAlgorithmsSupported", reflect.TypeOf((*MockConfiguration)(nil).RevocationEndpointSigningAlgorithmsSupported))
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevocationEndpointSigningAlgorithmsSupported", reflect.TypeOf((*MockConfiguration)(nil).RevocationEndpointSigningAlgorithmsSupported))
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportedClaims mocks base method.
|
|
||||||
func (m *MockConfiguration) SupportedClaims() []string {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
ret := m.ctrl.Call(m, "SupportedClaims")
|
|
||||||
ret0, _ := ret[0].([]string)
|
|
||||||
return ret0
|
|
||||||
}
|
|
||||||
|
|
||||||
// SupportedClaims indicates an expected call of SupportedClaims.
|
|
||||||
func (mr *MockConfigurationMockRecorder) SupportedClaims() *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SupportedClaims", reflect.TypeOf((*MockConfiguration)(nil).SupportedClaims))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SupportedUILocales mocks base method.
|
// SupportedUILocales mocks base method.
|
||||||
func (m *MockConfiguration) SupportedUILocales() []language.Tag {
|
func (m *MockConfiguration) SupportedUILocales() []language.Tag {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
|
|
|
@ -414,14 +414,6 @@ func (o *Provider) RequestObjectSigningAlgorithmsSupported() []string {
|
||||||
return []string{"RS256"}
|
return []string{"RS256"}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Provider) SupportedClaims() []string {
|
|
||||||
if o.config.SupportedClaims == nil {
|
|
||||||
return DefaultSupportedClaims
|
|
||||||
} else {
|
|
||||||
return o.config.SupportedClaims
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *Provider) SupportedUILocales() []language.Tag {
|
func (o *Provider) SupportedUILocales() []language.Tag {
|
||||||
return o.config.SupportedUILocales
|
return o.config.SupportedUILocales
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue