Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pkg/op): allow custom SupportedScopes #675

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/op/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ func createDiscoveryConfigV2(ctx context.Context, config Configuration, storage
}

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 {
Expand Down Expand Up @@ -135,7 +139,7 @@ func GrantTypes(c Configuration) []oidc.GrantType {
}

func SubjectTypes(c Configuration) []string {
return []string{"public"} //TODO: config
return []string{"public"} // TODO: config
muhlemmer marked this conversation as resolved.
Show resolved Hide resolved
}

func SigAlgorithms(ctx context.Context, storage DiscoverStorage) []string {
Expand Down
5 changes: 5 additions & 0 deletions pkg/op/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func Test_scopes(t *testing.T) {
args{},
op.DefaultSupportedScopes,
},
{
"custom scopes",
args{newTestProvider(&op.Config{SupportedScopes: []string{"test1", "test2"}})},
[]string{"test1", "test2"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/op/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ type Config struct {
RequestObjectSupported bool
SupportedUILocales []language.Tag
SupportedClaims []string
SupportedScopes []string
DeviceAuthorization DeviceAuthorizationConfig
BackChannelLogoutSupported bool
BackChannelLogoutSessionSupported bool
Expand Down
Loading