fixed endpoint processing to account for client id

pull/708/merge
Justin Richer 2015-03-10 15:37:07 -04:00
parent 99c57141cb
commit 8c8f912880
1 changed files with 10 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package org.mitre.uma.web;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -216,7 +217,15 @@ public class ResourceSetRegistrationEndpoint {
String owner = auth.getName();
Collection<ResourceSet> resourceSets = resourceSetService.getAllForOwner(owner);
Collection<ResourceSet> resourceSets = Collections.emptySet();
if (auth instanceof OAuth2Authentication) {
// if it's an OAuth mediated call, it's on behalf of a client, so look that up too
OAuth2Authentication o2a = (OAuth2Authentication) auth;
resourceSets = resourceSetService.getAllForOwnerAndClient(owner, o2a.getOAuth2Request().getClientId());
} else {
// otherwise get everything for the current user
resourceSets = resourceSetService.getAllForOwner(owner);
}
// build the entity here and send to the display