use of org.gluu.oxtrust.model.OxAuthSectorIdentifier in project oxTrust by GluuFederation.
the class SectorIdentifierWebResourceTest method searchSectorIdentifierTest.
@Test
public void searchSectorIdentifierTest() {
String searchPattern = "unknow";
String SEARCH_QUERY = "?" + ApiConstants.SEARCH_PATTERN + "=" + searchPattern + "&size=5";
HttpUriRequest request = new HttpGet(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.SECTORS + ApiConstants.SEARCH + SEARCH_QUERY);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
try {
OxAuthSectorIdentifier[] resources = mapper.readValue(EntityUtils.toString(entity), OxAuthSectorIdentifier[].class);
Assert.assertTrue(resources.length >= 0);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxtrust.model.OxAuthSectorIdentifier in project oxTrust by GluuFederation.
the class SectorIdentifierService method generateIdForNewSectorIdentifier.
/**
* Generate new oxId for sector identifier
*
* @return New oxId for sector identifier
* @throws Exception
*/
public String generateIdForNewSectorIdentifier() {
OxAuthSectorIdentifier sectorIdentifier = new OxAuthSectorIdentifier();
String newId = null;
String newDn = null;
do {
newId = generateIdForNewSectorIdentifierImpl();
newDn = getDnForSectorIdentifier(newId);
sectorIdentifier.setDn(newDn);
} while (persistenceEntryManager.contains(newDn, OxAuthSectorIdentifier.class));
return newId;
}
use of org.gluu.oxtrust.model.OxAuthSectorIdentifier in project oxTrust by GluuFederation.
the class SectorIdentifierService method searchSectorIdentifiers.
/**
* Search sector identifiers by pattern
*
* @param pattern
* Pattern
* @param sizeLimit
* Maximum count of results
* @return List of sector identifiers
*/
public List<OxAuthSectorIdentifier> searchSectorIdentifiers(String pattern, int sizeLimit) {
String[] targetArray = new String[] { pattern };
Filter searchFilter = Filter.createSubstringFilter(OxTrustConstants.oxId, null, targetArray, null);
List<OxAuthSectorIdentifier> result = persistenceEntryManager.findEntries(getDnForSectorIdentifier(null), OxAuthSectorIdentifier.class, searchFilter, sizeLimit);
return result;
}
use of org.gluu.oxtrust.model.OxAuthSectorIdentifier in project oxTrust by GluuFederation.
the class SectorIdentifierService method generateInumForNewSectorIdentifier.
/**
* Generate new inum for sector identifier
*
* @return New inum for sector identifier
* @throws Exception
*/
public String generateInumForNewSectorIdentifier() throws Exception {
OxAuthSectorIdentifier sectorIdentifier = new OxAuthSectorIdentifier();
String newInum = null;
do {
newInum = generateInumForNewSectorIdentifierImpl();
String newDn = getDnForSectorIdentifier(newInum);
sectorIdentifier.setDn(newDn);
} while (ldapEntryManager.contains(sectorIdentifier));
return newInum;
}
use of org.gluu.oxtrust.model.OxAuthSectorIdentifier in project oxTrust by GluuFederation.
the class UpdateSectorIdentifierAction method add.
public String add() throws Exception {
if (this.sectorIdentifier != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = false;
this.sectorIdentifier = new OxAuthSectorIdentifier();
try {
this.loginUris = getNonEmptyStringList(sectorIdentifier.getRedirectUris());
if (sectorIdentifier.getClientIds() != null && sectorIdentifier.getClientIds().size() > 0)
this.loginUris.addAll(clientRedirectUriList(sectorIdentifier.getClientIds()));
this.clientDisplayNameEntries = loadClientDisplayNameEntries();
} catch (BaseMappingException ex) {
log.error("Failed to load login Uris", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to add new sector identifier");
conversationService.endConversation();
return OxTrustConstants.RESULT_FAILURE;
}
return OxTrustConstants.RESULT_SUCCESS;
}
Aggregations