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 #498
pull/650/head
Justin Richer 2013-09-06 13:30:22 -04:00
parent 3524350086
commit 46e7ed203b
1 changed files with 5 additions and 5 deletions

View File

@ -116,14 +116,14 @@ public class ClientDynamicRegistrationEndpoint {
// scopes that the client is asking for
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
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));