本文整理汇总了Java中org.apache.directory.fortress.core.model.AuthZ类的典型用法代码示例。如果您正苦于以下问题:Java AuthZ类的具体用法?Java AuthZ怎么用?Java AuthZ使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthZ类属于org.apache.directory.fortress.core.model包,在下文中一共展示了AuthZ类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
FortResponse getUserAuthZs(FortRequest request)
{
FortResponse response = createResponse();
try
{
UserAudit inAudit = (UserAudit)request.getEntity();
AuditMgr auditMgr = AuditMgrFactory.createInstance( request.getContextId() );
auditMgr.setAdmin( request.getSession() );
List<AuthZ> outAudit = auditMgr.getUserAuthZs( inAudit );
response.setEntities( outAudit );
}
catch (SecurityException se)
{
createError( response, log, se );
}
return response;
}
示例2: searchAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
FortResponse searchAuthZs(FortRequest request)
{
FortResponse response = createResponse();
try
{
UserAudit inAudit = (UserAudit)request.getEntity();
AuditMgr auditMgr = AuditMgrFactory.createInstance( request.getContextId() );
auditMgr.setAdmin( request.getSession() );
List<AuthZ> outAudit = auditMgr.searchAuthZs( inAudit );
response.setEntities( outAudit );
}
catch (SecurityException se)
{
createError( response, log, se );
}
return response;
}
示例3: searchInvalidUsers
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
FortResponse searchInvalidUsers(FortRequest request)
{
FortResponse response = createResponse();
try
{
UserAudit inAudit = (UserAudit)request.getEntity();
AuditMgr auditMgr = AuditMgrFactory.createInstance( request.getContextId() );
auditMgr.setAdmin( request.getSession() );
List<AuthZ> outAudit = auditMgr.searchInvalidUsers( inAudit );
response.setEntities( outAudit );
}
catch (SecurityException se)
{
createError( response, log, se );
}
return response;
}
示例4: searchAuthNInvalid
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
*
* @param msg
*/
private static void searchAuthNInvalid( String msg )
{
LogUtil.logIt( msg );
try
{
AuditMgr auditMgr = getManagedAuditMgr();
UserAudit uAudit = new UserAudit();
List<AuthZ> resultSet = auditMgr.searchInvalidUsers( uAudit );
assertNotNull( resultSet );
assertTrue( CLS_NM + "searchInvalidUsers failed search for invalid authentications", resultSet.size() > 0 );
LOG.debug( "searchInvalidUsers successful" );
}
catch ( SecurityException ex )
{
LOG.error( "searchInvalidUsers: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例5: getList
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
private List<AuthZ> getList( UserAudit userAudit )
{
List<AuthZ> authZList = null;
try
{
authZList = auditMgr.getUserAuthZs( userAudit );
}
catch (org.apache.directory.fortress.core.SecurityException se)
{
String error = ".getList caught SecurityException=" + se;
LOG.warn( error );
}
return authZList;
}
示例6: getUserAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* {@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;
}
示例7: searchAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* {@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;
}
示例8: searchInvalidUsers
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* {@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;
}
示例9: getAuthzEntityFromLdapEntry
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* @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;
}
示例10: getUserAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public List<AuthZ> getUserAuthZs(UserAudit uAudit)
throws SecurityException
{
String methodName = "getUserAuthZs";
assertContext(CLS_NM, methodName, uAudit, GlobalErrIds.AUDT_INPUT_NULL);
checkAccess(CLS_NM, methodName);
return auditP.getAuthZs(uAudit);
}
示例11: searchAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public List<AuthZ> searchAuthZs(UserAudit uAudit)
throws SecurityException
{
String methodName = "searchAuthZs";
assertContext(CLS_NM, methodName, uAudit, GlobalErrIds.AUDT_INPUT_NULL);
checkAccess(CLS_NM, methodName);
return auditP.searchAuthZs(uAudit);
}
示例12: searchInvalidUsers
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public List<AuthZ> searchInvalidUsers(UserAudit uAudit)
throws SecurityException
{
String methodName = "searchInvalidUsers";
assertContext(CLS_NM, methodName, uAudit, GlobalErrIds.AUDT_INPUT_NULL);
checkAccess(CLS_NM, methodName);
return auditP.searchInvalidAuthNs(uAudit);
}
示例13: getAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
*
*/
void getAuthZs()
{
ReaderUtil.clearScreen();
try
{
UserAudit uAudit = new UserAudit();
System.out.println("Enter userId to search Audit AuthZs with:");
String val = ReaderUtil.readLn();
if(StringUtils.isNotEmpty( val ))
{
uAudit.setUserId(val);
System.out.println("size=" + val.length() + " val=" + val);
}
else
{
System.out.println("val is empty or null");
}
System.out.println("Check for failed only? (Enter 'Y' for yes or 'N' for no");
val = ReaderUtil.readLn();
if (val.equalsIgnoreCase("Y"))
uAudit.setFailedOnly(true);
List<AuthZ> list = am.getUserAuthZs(uAudit);
printAuthZs(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("getUserAuthZs caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例14: getAuthZPerm
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
* Break the authZ eqDn attribute into 1. permission object name, 2. op name and 3. object id (optional).
*
* @param authZ contains the raw dn format from openldap slapo access log data
* @return Permisison containing objName, opName and optionally the objId populated from the raw data.
*/
public static Permission getAuthZPerm(AuthZ authZ) throws LdapInvalidDnException
{
// This will be returned to the caller:
Permission pOp = new Permission();
// Break dn into rdns for leaf and parent. Use the 'type' field in rdn.
// The objId value is optional. If present it will be part of the parent's relative distinguished name..
// Here the sample reqDN=ftOpNm=TOP2_2+ftObjId=002,ftObjNm=TOB2_1,ou=Permissions,ou=RBAC,dc=example,dc=com
// Will be mapped to objName=TOB2_1, opName=TOP2_2, objId=002, in the returned permission object.
Dn dn = new Dn( authZ.getReqDN() );
if( dn.getRdns() != null && CollectionUtils.isNotEmpty( dn.getRdns() ) )
{
for( Rdn rdn : dn.getRdns() )
{
// The rdn type attribute will be mapped to objName, opName and objId fields.
switch ( rdn.getType() )
{
case GlobalIds.POP_NAME:
pOp.setOpName( rdn.getType() );
break;
case GlobalIds.POBJ_NAME:
pOp.setObjName( rdn.getType() );
break;
case GlobalIds.POBJ_ID:
pOp.setObjId( rdn.getType() );
break;
}
}
}
return pOp;
}
示例15: getAuthZs
import org.apache.directory.fortress.core.model.AuthZ; //导入依赖的package包/类
/**
*
* @param msg
* @param uArray
*/
private static void getAuthZs( String msg, String[][] uArray )
{
LogUtil.logIt( msg );
try
{
AuditMgr auditMgr = getManagedAuditMgr();
for ( String[] usr : uArray )
{
User user = UserTestData.getUser( usr );
// now search for successful authentications:
UserAudit uAudit = new UserAudit();
uAudit.setUserId( user.getUserId() );
uAudit.setFailedOnly( false );
List<AuthZ> authZs = auditMgr.getUserAuthZs( uAudit );
assertNotNull( authZs );
assertTrue(
CLS_NM + "getUserAuthZs failed search for successful authorization user [" + user.getUserId() + "]",
authZs.size() > 0 );
// now search for failed authentications:
uAudit.setFailedOnly( true );
authZs = auditMgr.getUserAuthZs( uAudit );
assertNotNull( authZs );
assertTrue( CLS_NM + "getUserAuthZs failed search for failed authorization user [" + user.getUserId()
+ "]", authZs.size() > 0 );
}
LOG.debug( "getUserAuthZs successful" );
}
catch ( SecurityException ex )
{
LOG.error(
"getUserAuthZs: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}