use of org.gluu.oxtrust.model.OxAuthScope in project oxTrust by GluuFederation.
the class ScopeService method searchScopes.
/**
* Search scopes by pattern
*
* @param pattern
* Pattern
* @param sizeLimit
* Maximum count of results
* @return List of scopes
* @throws Exception
*/
public List<OxAuthScope> searchScopes(String pattern, int sizeLimit) throws Exception {
Filter searchFilter = null;
if (StringHelper.isNotEmpty(pattern)) {
String[] targetArray = new String[] { pattern };
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter, inameFilter);
}
List<OxAuthScope> result = ldapEntryManager.findEntries(getDnForScope(null), OxAuthScope.class, searchFilter, 0, sizeLimit);
return result;
}
use of org.gluu.oxtrust.model.OxAuthScope in project oxTrust by GluuFederation.
the class ScopeService method getScopeByDisplayName.
/**
* Get scope by DisplayName
*
* @param DisplayName
* @return scope
*/
public OxAuthScope getScopeByDisplayName(String DisplayName) throws Exception {
OxAuthScope scope = new OxAuthScope();
scope.setBaseDn(getDnForScope(null));
scope.setDisplayName(DisplayName);
List<OxAuthScope> scopes = ldapEntryManager.findEntries(scope);
if ((scopes != null) && (scopes.size() > 0)) {
return scopes.get(0);
}
return null;
}
use of org.gluu.oxtrust.model.OxAuthScope in project oxTrust by GluuFederation.
the class ScopeService method generateInumForNewScope.
/**
* Generate new inum for scope
*
* @return New inum for scope
*/
public String generateInumForNewScope() throws Exception {
OxAuthScope scope = new OxAuthScope();
String newInum = null;
do {
newInum = generateInumForNewScopeImpl();
String newDn = getDnForScope(newInum);
scope.setDn(newDn);
} while (ldapEntryManager.contains(scope));
return newInum;
}
use of org.gluu.oxtrust.model.OxAuthScope in project oxTrust by GluuFederation.
the class UpdateScopeAction method add.
public String add() throws Exception {
if (this.scope != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = false;
this.scope = new OxAuthScope();
try {
if (this.scope.getOxAuthClaims() != null && this.scope.getOxAuthClaims().size() > 0) {
this.claims = getClaimDisplayNameEntiries();
} else {
this.claims = new ArrayList<DisplayNameEntry>();
}
} catch (LdapMappingException ex) {
log.error("Failed to load scopes", ex);
return OxTrustConstants.RESULT_FAILURE;
}
this.dynamicScripts = getInitialDynamicScripts();
return OxTrustConstants.RESULT_SUCCESS;
}
Aggregations