use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class UserP method validate.
/**
* Ensure that the passed in role constraint is valid
*
* @param rc RoleConstaint
* @param contextId
* @throws ValidationException
*/
private void validate(RoleConstraint rc, String contextId) throws ValidationException {
if (StringUtils.isEmpty(rc.getPaSetName())) {
throw new ValidationException(GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + ".validate pa set name is NULL");
}
try {
PermP permP = new PermP();
permP.validatePaSet(rc.getPaSetName(), contextId);
} catch (SecurityException e) {
String error = "validate - paSetName not found with name [" + rc.getPaSetName() + "] caught SecurityException=" + e;
throw new ValidationException(GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, error);
}
if (rc.getType() == null) {
throw new ValidationException(GlobalErrIds.ROLE_CONSTRAINT_TYPE_NULL, CLS_NM + ".validate type is NULL");
}
if (StringUtils.isEmpty(rc.getValue())) {
throw new ValidationException(GlobalErrIds.ROLE_CONSTRAINT_VALUE_NULL, CLS_NM + ".validate value is NULL");
}
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AuditMgrRestImpl method getUserAuthZs.
/**
* {@inheritDoc}
*/
@Override
public List<AuthZ> getUserAuthZs(UserAudit uAudit) throws SecurityException {
VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".getUserAuthZs");
List<AuthZ> outRecords;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(uAudit);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.AUDIT_UAUTHZS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
outRecords = response.getEntities();
// do not return a null list to the caller:
if (outRecords == null) {
outRecords = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return outRecords;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AuditMgrRestImpl method searchAuthZs.
/**
* {@inheritDoc}
*/
@Override
public List<AuthZ> searchAuthZs(UserAudit uAudit) throws SecurityException {
VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".searchAuthZs");
List<AuthZ> outRecords;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(uAudit);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.AUDIT_AUTHZS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
outRecords = response.getEntities();
// do not return a null list to the caller:
if (outRecords == null) {
outRecords = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return outRecords;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AuditMgrRestImpl method searchAdminMods.
/**
* {@inheritDoc}
*/
@Override
public List<Mod> searchAdminMods(UserAudit uAudit) throws SecurityException {
VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".searchAdminMods");
List<Mod> outRecords;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(uAudit);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.AUDIT_MODS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
outRecords = response.getEntities();
// do not return a null list to the caller:
if (outRecords == null) {
outRecords = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return outRecords;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AuditMgrRestImpl method searchBinds.
/**
* {@inheritDoc}
*/
@Override
public List<Bind> searchBinds(UserAudit uAudit) throws SecurityException {
VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".searchBinds");
List<Bind> outRecords;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(uAudit);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.AUDIT_BINDS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
outRecords = response.getEntities();
// do not return a null list to the caller:
if (outRecords == null) {
outRecords = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return outRecords;
}
Aggregations