use of org.gluu.oxtrust.model.OxAuthClient 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.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class ClientWebService method list.
@GET
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletResponse response) {
try {
List<OxAuthClient> clientList = clientService.getAllClients();
ObjectMapper mapper = new ObjectMapper();
String clientListJson = mapper.writeValueAsString(clientList);
response.setStatus(HttpServletResponse.SC_OK);
return clientListJson;
} catch (Exception e) {
logger.error("delete() Exception", e);
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR");
} catch (Exception ex) {
}
return OxTrustConstants.RESULT_FAILURE;
}
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class ClientWebService method read.
// TODO
@GET
@Path("/read/{inum}")
@Produces(MediaType.APPLICATION_JSON)
public String read(@PathParam("inum") String inum, @Context HttpServletResponse response) {
try {
String result = null;
OxAuthClient client = clientService.getClientByInum(inum);
// TODO
ObjectMapper mapper = new ObjectMapper();
String clientJson = mapper.writeValueAsString(client);
response.setStatus(HttpServletResponse.SC_OK);
return clientJson;
} catch (Exception e) {
logger.error("read() Exception", e);
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR");
} catch (Exception ex) {
}
return null;
}
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class ClientService method getClientByIname.
/**
* returns oxAuthClient by Dn
*
* @return oxAuthClient
*/
/**
* Get Client by iname
*
* @param iname
* @return Client
*/
public OxAuthClient getClientByIname(String iname) {
OxAuthClient client = new OxAuthClient();
client.setBaseDn(getDnForClient(null));
client.setIname(iname);
List<OxAuthClient> clients = ldapEntryManager.findEntries(client);
if ((clients != null) && (clients.size() > 0)) {
return clients.get(0);
}
return null;
}
use of org.gluu.oxtrust.model.OxAuthClient in project oxTrust by GluuFederation.
the class SectorIdentifierService method removeSectorIdentifier.
/**
* Remove sector identifier entry
*
* @param sectorIdentifier Sector identifier
*/
public void removeSectorIdentifier(OxAuthSectorIdentifier sectorIdentifier) {
if (sectorIdentifier.getClientIds() != null) {
List<String> clientDNs = sectorIdentifier.getClientIds();
// clear references in Client entries
for (String clientDN : clientDNs) {
OxAuthClient client = clientService.getClientByDn(clientDN);
client.setSectorIdentifierUri(null);
clientService.updateClient(client);
}
}
ldapEntryManager.remove(sectorIdentifier);
}
Aggregations