Skip to content

Commit 46e7ed2

Browse files
author
Justin Richer
committed
if the client doesn't ask for any system scopes, but asks for some non-system scopes, they'll now get the defaults instead of none
addresses mitreid-connect#498
1 parent 3524350 commit 46e7ed2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientDynamicRegistrationEndpoint.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ public String registerNewClient(@RequestBody String jsonString, Model m) {
116116
// scopes that the client is asking for
117117
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
118118

119-
// if the client didn't ask for any, give them the defaults
120-
if (requestedScopes == null || requestedScopes.isEmpty()) {
121-
requestedScopes = scopeService.getDefaults();
122-
}
123-
124119
// the scopes that the client can have must be a subset of the dynamically allowed scopes
125120
Set<SystemScope> allowedScopes = Sets.intersection(dynScopes, requestedScopes);
126121

122+
// if the client didn't ask for any, give them the defaults
123+
if (allowedScopes == null || allowedScopes.isEmpty()) {
124+
allowedScopes = scopeService.getDefaults();
125+
}
126+
127127
newClient.setScope(scopeService.toStrings(allowedScopes));
128128

129129

0 commit comments

Comments
 (0)