use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method markAsInactive.
private void markAsInactive() {
// files in meta-data folder
if (update) {
try {
GluuSAMLTrustRelationship tmpTrustRelationship = trustService.getRelationshipByInum(this.trustRelationship.getInum());
tmpTrustRelationship.setStatus(GluuStatus.INACTIVE);
saveTR(update);
} catch (BaseMappingException ex) {
log.error("Failed to update trust relationship {}", inum, ex);
}
} else {
// Remove file name to generate new one during new save attempt.
// Cover case when somebody else added new one simultaneously
this.trustRelationship.setSpMetaDataFN(null);
this.trustRelationship.setInum(null);
}
}
use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method delete.
public String delete() {
String result = OxTrustConstants.RESULT_FAILURE;
if (update) {
// Remove trust relationship
try {
synchronized (svnSyncTimer) {
for (GluuSAMLTrustRelationship trust : trustService.getDeconstructedTrustRelationships(this.trustRelationship)) {
if (GluuStatus.ACTIVE.equals(trust.getStatus())) {
log.error("Failed to remove federation trust relationship {}, there are still active federated Trust Relationships left.", this.trustRelationship.getInum());
return result;
}
}
for (GluuSAMLTrustRelationship trust : trustService.getDeconstructedTrustRelationships(this.trustRelationship)) {
trustService.removeTrustRelationship(trust);
svnSyncTimer.removeTrustRelationship(trust, identity.getCredentials().getUsername());
}
shibboleth3ConfService.removeSpMetadataFile(this.trustRelationship.getSpMetaDataFN());
trustService.removeTrustRelationship(this.trustRelationship);
svnSyncTimer.removeTrustRelationship(this.trustRelationship, identity.getCredentials().getUsername());
}
result = OxTrustConstants.RESULT_SUCCESS;
} catch (BaseMappingException ex) {
result = OxTrustConstants.RESULT_FAILURE;
log.error("Failed to remove trust relationship {}", this.trustRelationship.getInum(), ex);
} catch (InterruptedException e) {
log.error("Failed to add trust relationship to remove queue. It will be removed during next application restart", e);
} finally {
List<GluuSAMLTrustRelationship> trustRelationships = trustService.getAllActiveTrustRelationships();
updateShibboleth3Configuration(trustRelationships);
}
}
if (OxTrustConstants.RESULT_SUCCESS.equals(result)) {
facesMessages.add(FacesMessage.SEVERITY_INFO, "Relationship '#{updateTrustRelationshipAction.trustRelationship.displayName}' removed successfully");
} else if (OxTrustConstants.RESULT_FAILURE.equals(result)) {
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to remove relationship '#{updateTrustRelationshipAction.trustRelationship.displayName}'");
}
return result;
}
use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.
the class ScopeDescriptionDownloadAction method getScopeDescription.
private UmaScopeDescription getScopeDescription() {
try {
scopeDescriptionService.prepareScopeDescriptionBranch();
} catch (Exception ex) {
log.error("Failed to initialize download action", ex);
return null;
}
log.debug("Loading UMA scope description '{}'", this.scopeId);
UmaScopeDescription scopeDescription;
try {
List<UmaScopeDescription> scopeDescriptions = scopeDescriptionService.findScopeDescriptionsById(this.scopeId);
if (scopeDescriptions.size() != 1) {
log.error("Failed to find scope description '{}'. Found: '{}'", this.scopeId, scopeDescriptions.size());
return null;
}
scopeDescription = scopeDescriptions.get(0);
} catch (BaseMappingException ex) {
log.error("Failed to find scope description '{}'", this.scopeId, ex);
return null;
}
return scopeDescription;
}
use of org.gluu.persist.exception.mapping.BaseMappingException 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;
}
use of org.gluu.persist.exception.mapping.BaseMappingException 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;
}
Aggregations