Search in sources :

Example 1 with UmaResource

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;
}
Also used : DisplayNameEntry(org.xdi.model.DisplayNameEntry) UmaResource(org.xdi.oxauth.model.uma.persistence.UmaResource)

Example 2 with UmaResource

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;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) OxAuthClient(org.gluu.oxtrust.model.OxAuthClient) UmaResource(org.xdi.oxauth.model.uma.persistence.UmaResource)

Example 3 with UmaResource

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;
}
Also used : UmaResource(org.xdi.oxauth.model.uma.persistence.UmaResource)

Example 4 with UmaResource

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;
}
Also used : Filter(org.gluu.search.filter.Filter) UmaResource(org.xdi.oxauth.model.uma.persistence.UmaResource)

Aggregations

UmaResource (org.xdi.oxauth.model.uma.persistence.UmaResource)4 OxAuthClient (org.gluu.oxtrust.model.OxAuthClient)1 BaseMappingException (org.gluu.persist.exception.mapping.BaseMappingException)1 Filter (org.gluu.search.filter.Filter)1 DisplayNameEntry (org.xdi.model.DisplayNameEntry)1