use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class ClientAssociationWebService method getAssociatedPersons.
@Path("/Client/{cid}")
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getAssociatedPersons(@HeaderParam("Authorization") String authorization, @PathParam("cid") String cid) throws Exception {
Response authorizationResponse = processAuthorization(authorization);
if (authorizationResponse != null) {
return authorizationResponse;
}
try {
log.info("getting the client");
OxAuthClient client = clientService.getClientByInum(cid);
if (client == null) {
// sets HTTP status code 404 Not Found
return getErrorResponse("Resource " + cid + " not found", Response.Status.NOT_FOUND.getStatusCode());
}
log.info("mapping client attributes");
ClientAssociation clientAssociation = MapperUtil.map(client, null);
log.info("getting URL");
URI location = new URI("/ClientAssociation/Client/" + cid);
log.info("returning response");
return Response.ok(clientAssociation).location(location).build();
} catch (EntryPersistenceException ex) {
log.error("Exception: ", ex);
return getErrorResponse("Resource " + cid + " not found", Response.Status.NOT_FOUND.getStatusCode());
} catch (Exception ex) {
log.error("Exception: ", ex);
return getErrorResponse(INTERNAL_SERVER_ERROR_MESSAGE, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class UpdateSectorIdentifierAction method clientRedirectUriList.
private List<String> clientRedirectUriList(List<String> clientInum) {
List<String> clientRedirectUri = new ArrayList<String>();
for (int i = 0; i < clientInum.size(); i++) {
OxAuthClient OxAuthClient = clientService.getClientByInum(clientInum.get(i));
clientRedirectUri.addAll(OxAuthClient.getOxAuthRedirectURIs());
}
return clientRedirectUri;
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class UpdateResourceSetAction method acceptSelectClients.
public void acceptSelectClients() {
Set<String> addedClientInums = getAddedClientsInums();
for (SelectableEntity<OxAuthClient> availableClient : this.availableClients) {
OxAuthClient oxAuthClient = availableClient.getEntity();
String oxAuthClientInum = oxAuthClient.getInum();
if (availableClient.isSelected() && !addedClientInums.contains(oxAuthClientInum)) {
addClient(oxAuthClient);
}
if (!availableClient.isSelected() && addedClientInums.contains(oxAuthClientInum)) {
removeClient(oxAuthClientInum);
}
}
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class UpdateClientAction method add.
public String add() throws Exception {
if (this.client != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = false;
this.client = new OxAuthClient();
try {
this.loginUris = getNonEmptyStringList(client.getOxAuthRedirectURIs());
this.logoutUris = getNonEmptyStringList(client.getOxAuthPostLogoutRedirectURIs());
this.clientlogoutUris = getNonEmptyStringList(client.getLogoutUri());
this.scopes = getInitialScopeDisplayNameEntiries();
this.responseTypes = getInitialResponseTypes();
this.grantTypes = getInitialGrantTypes();
this.contacts = getNonEmptyStringList(client.getContacts());
this.defaultAcrValues = getNonEmptyStringList(client.getDefaultAcrValues());
this.requestUris = getNonEmptyStringList(client.getRequestUris());
this.authorizedOrigins = getNonEmptyStringList(client.getAuthorizedOrigins());
this.claimRedirectURIList = getNonEmptyStringList(client.getClaimRedirectURI());
} catch (BaseMappingException ex) {
log.error("Failed to prepare lists", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to add new client");
conversationService.endConversation();
return OxTrustConstants.RESULT_FAILURE;
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class UpdateResourceAction method update.
private String update() {
log.debug("Loading UMA resource set '{}'", this.oxId);
try {
String resourceDn = umaResourcesService.getDnForResource(this.oxId);
this.resource = umaResourcesService.getResourceByDn(resourceDn);
} catch (BaseMappingException ex) {
log.error("Failed to find resource set '{}'", this.oxId, ex);
return OxTrustConstants.RESULT_FAILURE;
}
if (this.resource == null) {
log.error("Resource set is null");
return OxTrustConstants.RESULT_FAILURE;
}
this.scopes = getScopesDisplayNameEntries();
this.clients = getClientDisplayNameEntries();
List<String> list = this.resource.getClients();
if (list != null) {
clientList = new ArrayList<OxAuthClient>();
for (String clientDn : list) {
OxAuthClient oxAuthClient = clientService.getClientByDn(clientDn);
clientList.add(oxAuthClient);
}
}
if (this.resource.getResources() == null) {
this.resources = new ArrayList<String>();
} else {
this.resources = new ArrayList<String>(this.resource.getResources());
}
return OxTrustConstants.RESULT_SUCCESS;
}
Aggregations