Search in sources :

Example 16 with AuthZ

use of org.apache.directory.fortress.core.model.AuthZ in project directory-fortress-core by apache.

the class AuditMgrRestImpl method searchInvalidUsers.

/**
 * {@inheritDoc}
 */
@Override
public List<AuthZ> searchInvalidUsers(UserAudit uAudit) throws SecurityException {
    VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".searchInvalidUsers");
    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_INVLD);
    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;
}
Also used : AuthZ(org.apache.directory.fortress.core.model.AuthZ) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 17 with AuthZ

use of org.apache.directory.fortress.core.model.AuthZ in project directory-fortress-core by apache.

the class AuditDAO method getAuthzEntityFromLdapEntry.

/**
 * @param le
 * @return
 * @throws LdapInvalidAttributeValueException
 * @throws LdapException
 */
private AuthZ getAuthzEntityFromLdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException {
    // these attrs also on audit bind OC:
    AuthZ authZ = new ObjectFactory().createAuthZ();
    authZ.setSequenceId(sequence);
    authZ.setCreateTimestamp(getAttribute(le, CREATETIMESTAMP));
    authZ.setCreatorsName(getAttribute(le, CREATORSNAME));
    authZ.setEntryCSN(getAttribute(le, ENTRYCSN));
    authZ.setEntryDN(getAttribute(le, ENTRYDN));
    authZ.setEntryUUID(getAttribute(le, ENTRYUUID));
    authZ.setHasSubordinates(getAttribute(le, HASSUBORDINATES));
    authZ.setModifiersName(getAttribute(le, MODIFIERSNAME));
    authZ.setModifyTimestamp(getAttribute(le, MODIFYTIMESTAMP));
    authZ.setObjectClass(getAttribute(le, OBJECTCLASS));
    authZ.setReqAuthzID(getAttribute(le, REQUAUTHZID));
    authZ.setReqControls(getAttribute(le, REQCONTROLS));
    authZ.setReqDN(getAttribute(le, REQDN));
    authZ.setReqEnd(getAttribute(le, REQEND));
    authZ.setReqResult(getAttribute(le, REQRESULT));
    authZ.setReqSession(getAttribute(le, REQSESSION));
    authZ.setReqStart(getAttribute(le, REQSTART));
    authZ.setReqType(getAttribute(le, REQTYPE));
    authZ.setStructuralObjectClass(getAttribute(le, STRUCTURALOBJECTCLASS));
    // these attrs only on audit search OC:
    authZ.setReqAttr(getAttribute(le, REQATTR));
    authZ.setReqAttrsOnly(getAttribute(le, REQATTRSONLY));
    authZ.setReqDerefAliases(getAttribute(le, REQDREFALIASES));
    authZ.setReqEntries(getAttribute(le, REQENTRIES));
    authZ.setReqFilter(getAttribute(le, REQFILTER));
    authZ.setReqScope(getAttribute(le, REQSCOPE));
    authZ.setReqSizeLimit(getAttribute(le, REQSIZELIMIT));
    authZ.setReqTimeLimit(getAttribute(le, REQTIMELIMIT));
    return authZ;
}
Also used : ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory) AuthZ(org.apache.directory.fortress.core.model.AuthZ)

Aggregations

AuthZ (org.apache.directory.fortress.core.model.AuthZ)17 UserAudit (org.apache.directory.fortress.core.model.UserAudit)7 SecurityException (org.apache.directory.fortress.core.SecurityException)6 Date (java.util.Date)4 ArrayList (java.util.ArrayList)3 CursorException (org.apache.directory.api.ldap.model.cursor.CursorException)3 SearchCursor (org.apache.directory.api.ldap.model.cursor.SearchCursor)3 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)3 AuditMgr (org.apache.directory.fortress.core.AuditMgr)3 FinderException (org.apache.directory.fortress.core.FinderException)3 FortRequest (org.apache.directory.fortress.core.model.FortRequest)3 FortResponse (org.apache.directory.fortress.core.model.FortResponse)3 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)3 ParseException (java.text.ParseException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 User (org.apache.directory.fortress.core.model.User)2 LdapInvalidDnException (org.apache.directory.api.ldap.model.exception.LdapInvalidDnException)1 ObjectFactory (org.apache.directory.fortress.core.model.ObjectFactory)1 Permission (org.apache.directory.fortress.core.model.Permission)1