feat(pkg/op): allow custom SupportedScopes
This commit is contained in:
parent
fbf009fe75
commit
1c06209f84
3 changed files with 12 additions and 2 deletions
|
@ -100,7 +100,11 @@ func createDiscoveryConfigV2(ctx context.Context, config Configuration, storage
|
||||||
}
|
}
|
||||||
|
|
||||||
func Scopes(c Configuration) []string {
|
func Scopes(c Configuration) []string {
|
||||||
return DefaultSupportedScopes // TODO: config
|
provider, ok := c.(*Provider)
|
||||||
|
if ok && provider.config.SupportedScopes != nil {
|
||||||
|
return provider.config.SupportedScopes
|
||||||
|
}
|
||||||
|
return DefaultSupportedScopes
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResponseTypes(c Configuration) []string {
|
func ResponseTypes(c Configuration) []string {
|
||||||
|
@ -135,7 +139,7 @@ func GrantTypes(c Configuration) []oidc.GrantType {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SubjectTypes(c Configuration) []string {
|
func SubjectTypes(c Configuration) []string {
|
||||||
return []string{"public"} //TODO: config
|
return []string{"public"} // TODO: config
|
||||||
}
|
}
|
||||||
|
|
||||||
func SigAlgorithms(ctx context.Context, storage DiscoverStorage) []string {
|
func SigAlgorithms(ctx context.Context, storage DiscoverStorage) []string {
|
||||||
|
|
|
@ -81,6 +81,11 @@ func Test_scopes(t *testing.T) {
|
||||||
args{},
|
args{},
|
||||||
op.DefaultSupportedScopes,
|
op.DefaultSupportedScopes,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"custom scopes",
|
||||||
|
args{newTestProvider(&op.Config{SupportedScopes: []string{"test1", "test2"}})},
|
||||||
|
[]string{"test1", "test2"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
|
@ -167,6 +167,7 @@ type Config struct {
|
||||||
RequestObjectSupported bool
|
RequestObjectSupported bool
|
||||||
SupportedUILocales []language.Tag
|
SupportedUILocales []language.Tag
|
||||||
SupportedClaims []string
|
SupportedClaims []string
|
||||||
|
SupportedScopes []string
|
||||||
DeviceAuthorization DeviceAuthorizationConfig
|
DeviceAuthorization DeviceAuthorizationConfig
|
||||||
BackChannelLogoutSupported bool
|
BackChannelLogoutSupported bool
|
||||||
BackChannelLogoutSessionSupported bool
|
BackChannelLogoutSessionSupported bool
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue