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 #498pull/516/head
parent
64bbb73d1b
commit
127507246e
|
@ -116,14 +116,14 @@ public class ClientDynamicRegistrationEndpoint {
|
||||||
// scopes that the client is asking for
|
// scopes that the client is asking for
|
||||||
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
|
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
|
||||||
|
|
||||||
// if the client didn't ask for any, give them the defaults
|
|
||||||
if (requestedScopes == null || requestedScopes.isEmpty()) {
|
|
||||||
requestedScopes = scopeService.getDefaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
// the scopes that the client can have must be a subset of the dynamically allowed scopes
|
// the scopes that the client can have must be a subset of the dynamically allowed scopes
|
||||||
Set<SystemScope> allowedScopes = Sets.intersection(dynScopes, requestedScopes);
|
Set<SystemScope> allowedScopes = Sets.intersection(dynScopes, requestedScopes);
|
||||||
|
|
||||||
|
// if the client didn't ask for any, give them the defaults
|
||||||
|
if (allowedScopes == null || allowedScopes.isEmpty()) {
|
||||||
|
allowedScopes = scopeService.getDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
newClient.setScope(scopeService.toStrings(allowedScopes));
|
newClient.setScope(scopeService.toStrings(allowedScopes));
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue