use of org.xdi.oxauth.model.uma.persistence.UmaResource in project oxTrust by GluuFederation.
the class UpdateResourceAction method add.
private String add() {
this.resource = new UmaResource();
this.scopes = new ArrayList<DisplayNameEntry>();
this.clients = new ArrayList<DisplayNameEntry>();
this.resources = new ArrayList<String>();
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.xdi.oxauth.model.uma.persistence.UmaResource in project oxTrust by GluuFederation.
the class UpdateScopeDescriptionAction method update.
private String update() {
if (this.scopeDescription != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
log.debug("Loading UMA resource '{}'", this.scopeInum);
try {
String scopeDn = scopeDescriptionService.getDnForScopeDescription(this.scopeInum);
this.scopeDescription = scopeDescriptionService.getScopeDescriptionByDn(scopeDn);
this.authorizationPolicies = getInitialAuthorizationPolicies();
List<UmaResource> umaResourceList = resourceSetService.findResourcesByScope(scopeDn);
if (umaResourceList != null) {
for (UmaResource umaResource : umaResourceList) {
List<String> list = umaResource.getClients();
if (list != null) {
clientList = new ArrayList<OxAuthClient>();
for (String clientDn : list) {
OxAuthClient oxAuthClient = clientService.getClientByDn(clientDn);
clientList.add(oxAuthClient);
}
}
}
}
} catch (BaseMappingException ex) {
log.error("Failed to find scope description '{}'", this.scopeInum, ex);
return OxTrustConstants.RESULT_FAILURE;
}
if (this.scopeDescription == null) {
log.error("Scope description is null");
return OxTrustConstants.RESULT_FAILURE;
}
initIconImage();
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.xdi.oxauth.model.uma.persistence.UmaResource in project oxTrust by GluuFederation.
the class ResourceSetService method generateInumForNewResource.
/**
* Generate new inum for resource set
*
* @return New inum for resource set
*/
public String generateInumForNewResource() {
UmaResource resource = new UmaResource();
String newInum = null;
do {
newInum = generateInumForNewResourceImpl();
String newDn = getDnForResource(newInum);
resource.setDn(newDn);
} while (ldapEntryManager.contains(resource));
return newInum;
}
use of org.xdi.oxauth.model.uma.persistence.UmaResource in project oxTrust by GluuFederation.
the class ResourceSetService method findResources.
/**
* Search resources by pattern
*
* @param pattern Pattern
* @param sizeLimit Maximum count of results
* @return List of resources
*/
public List<UmaResource> findResources(String pattern, int sizeLimit) {
String[] targetArray = new String[] { pattern };
Filter oxIdFilter = Filter.createSubstringFilter("oxId", null, targetArray, null);
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(oxIdFilter, displayNameFilter);
List<UmaResource> result = ldapEntryManager.findEntries(getDnForResource(null), UmaResource.class, searchFilter, sizeLimit);
return result;
}
Aggregations