本文整理汇总了Java中org.apache.directory.fortress.core.model.UserAudit.setUserId方法的典型用法代码示例。如果您正苦于以下问题:Java UserAudit.setUserId方法的具体用法?Java UserAudit.setUserId怎么用?Java UserAudit.setUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.fortress.core.model.UserAudit
的用法示例。
在下文中一共展示了UserAudit.setUserId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findBinds
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
*/
void findBinds()
{
ReaderUtil.clearScreen();
try
{
System.out.println("Enter userId value to search Audit Binds with or null to retrieve all:");
String val = ReaderUtil.readLn();
UserAudit uAudit = new UserAudit();
uAudit.setUserId(val);
List<Bind> list = am.searchBinds(uAudit);
printAuthNs(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("findBinds caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例2: getBindReport
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
*/
void getBindReport()
{
ReaderUtil.clearScreen();
try
{
System.out.println("Enter userId value to search Audit Binds with or null to retrieve all:");
String val = ReaderUtil.readLn();
UserAudit uAudit = new UserAudit();
uAudit.setUserId(val);
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);
System.out.println("Check within the last n hours? Enter number of hours or null for unlimited");
val = ReaderUtil.readLn();
if (val != null && val.length() > 0)
{
int hours = Integer.parseInt(val);
Date date = new Date();
long millis = date.getTime();
millis = millis - (1000 * 60 * 60 * hours);
Date date2 = new Date(millis);
uAudit.setBeginDate(date2);
}
List<Bind> list = am.searchBinds(uAudit);
printAuthNReport(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("getBindReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例3: getAuthZs
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的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();
}
示例4: searchMods
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
* @param msg
* @param uArray
*/
private static void searchMods( String msg, String[][] uArray )
{
LogUtil.logIt( msg );
try
{
AuditMgr auditMgr = getManagedAuditMgr();
for ( String[] usr : uArray )
{
User user = UserTestData.getUser( usr );
// now search for successful session creation events:
UserAudit uAudit = new UserAudit();
uAudit.setUserId( user.getUserId() );
uAudit.setFailedOnly( false );
List<Mod> mods = auditMgr.searchUserSessions( uAudit );
assertNotNull( mods );
assertTrue(
CLS_NM + "searchUserSessions failed search for successful authentication user [" + user.getUserId()
+ "]", mods.size() > 0 );
}
LOG.debug( "searchUserSessions successful" );
}
catch ( SecurityException ex )
{
LOG.error( "searchUserSessions: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例5: getAuthZs
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的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() );
}
}
示例6: searchBinds
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
* @param msg
* @param uArray
*/
private static void searchBinds( 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<Bind> binds = auditMgr.searchBinds( uAudit );
assertNotNull( binds );
assertTrue(
CLS_NM + "searchBinds failed search for successful authentication user [" + user.getUserId() + "]",
binds.size() > 0 );
// now search for failed authentications:
uAudit.setFailedOnly( true );
binds = auditMgr.searchBinds( uAudit );
assertNotNull( binds );
assertTrue( CLS_NM + "searchBinds failed search for failed authentication user [" + user.getUserId()
+ "]", binds.size() > 0 );
}
LOG.debug( "searchBinds successful" );
}
catch ( SecurityException ex )
{
LOG.error(
"searchBinds: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例7: findAuthZs
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
*/
void findAuthZs()
{
ReaderUtil.clearScreen();
try
{
System.out.println("Enter object name to search Audit AuthZs with:");
String val = ReaderUtil.readLn();
UserAudit uAudit = new UserAudit();
uAudit.setObjName(val);
System.out.println("Enter operation name to search Audit AuthZs with:");
val = ReaderUtil.readLn();
uAudit.setOpName(val);
System.out.println("Enter userId to search Audit AuthZs with:");
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");
}
//uAudit.setUserId(val);
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.searchAuthZs(uAudit);
printAuthZs(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("findAuthZs caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例8: getAuthReport
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
*/
void getAuthReport()
{
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");
}
//uAudit.setUserId(val);
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);
System.out.println("Check within the last n hours? Enter number of hours or null for unlimited");
val = ReaderUtil.readLn();
if (val != null && val.length() > 0)
{
int hours = Integer.parseInt(val);
Date date = new Date();
long millis = date.getTime();
millis = millis - (1000 * 60 * 60 * hours);
Date date2 = new Date(millis);
uAudit.setBeginDate(date2);
}
List<AuthZ> list = am.getUserAuthZs(uAudit);
printAuthZReport(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("getAuthReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例9: getModReport
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
*/
void getModReport()
{
ReaderUtil.clearScreen();
try
{
UserAudit uAudit = new UserAudit();
System.out.println("Enter userId to search Audit Mods 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 within the last n hours? Enter number of hours or null for unlimited");
val = ReaderUtil.readLn();
if (val != null && val.length() > 0)
{
int hours = Integer.parseInt(val);
Date date = new Date();
long millis = date.getTime();
millis = millis - (1000 * 60 * 60 * hours);
Date date2 = new Date(millis);
uAudit.setBeginDate(date2);
}
List<Mod> list = am.searchUserSessions(uAudit);
printMods(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("getModReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例10: getAdminModReport
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
void getAdminModReport()
{
ReaderUtil.clearScreen();
try
{
UserAudit uAudit = new UserAudit();
System.out.println("Enter userId to search Audit Mods with or NULL for skip:");
String val = ReaderUtil.readLn();
if(StringUtils.isNotEmpty( val ))
{
uAudit.setUserId(val);
System.out.println("size=" + val.length() + " val=" + val);
}
System.out.println("Check within the last n hours? Enter number of hours or null for unlimited");
val = ReaderUtil.readLn();
if (val != null && val.length() > 0)
{
int hours = Integer.parseInt(val);
Date date = new Date();
long millis = date.getTime();
millis = millis - (1000 * 60 * 60 * hours);
Date date2 = new Date(millis);
uAudit.setBeginDate(date2);
}
/*
System.out.println("Enter begin time and date - format YYYYMMDDHHMM or null for unlimited");
val = ReaderUtil.readLn();
if (val != null && val.length() > 0)
{
//int hours = Integer.parseInt(val);
int year = new Integer(val.substring(0, 3));
int month = new Integer(val.substring(0, 3));
int day = new Integer(val.substring(0, 3));
Date date = new Date();
java.sql.Date date2 = new java.sql.Date(2011, 11, 25);
date2.getTime();
long millis = date.getTime();
millis = millis - (1000 * 60 * 60 * hours);
Date date2 = new Date(millis);
uAudit.setBeginDate(date2);
} */
System.out.println("Enter admin object name to search Audit Mods with or NULL for skip:");
val = ReaderUtil.readLn();
if(StringUtils.isNotEmpty( val ))
{
uAudit.setObjName(val);
System.out.println("size=" + val.length() + " val=" + val);
}
System.out.println("Enter admin operation name to search Audit Mods with or NULL for skip:");
val = ReaderUtil.readLn();
if(StringUtils.isNotEmpty( val ))
{
uAudit.setOpName(val);
System.out.println("size=" + val.length() + " val=" + val);
}
List<Mod> list = am.searchAdminMods(uAudit);
printMods(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("getAdminModReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例11: getAuthNInvalidReport
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
void getAuthNInvalidReport()
{
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");
}
//uAudit.setUserId(val);
//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);
System.out.println("Check within the last n hours? Enter number of hours or null for unlimited");
val = ReaderUtil.readLn();
if (val != null && val.length() > 0)
{
int hours = Integer.parseInt(val);
Date date = new Date();
long millis = date.getTime();
millis = millis - (1000 * 60 * 60 * hours);
Date date2 = new Date(millis);
uAudit.setBeginDate(date2);
}
List<AuthZ> list = am.searchInvalidUsers(uAudit);
printfailedAuthNReport(list);
System.out.println("ENTER to continue");
}
catch (SecurityException e)
{
LOG.error("getAuthNInvalidReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
示例12: searchAdminMods
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
* @param msg
* @param uArray
*/
private static void searchAdminMods( String msg, String[][] uArray, String[][] oArray, String[][] opArray )
{
LogUtil.logIt( msg );
try
{
AuditMgr auditMgr = getManagedAuditMgr();
for ( String[] usr : uArray )
{
User user = UserTestData.getUser( usr );
// now search for successful session creation events:
UserAudit uAudit = new UserAudit();
uAudit.setUserId( user.getUserId() );
for ( String[] obj : oArray )
{
String objName = AdminUtil.getObjName( PermTestData.getName( obj ) );
uAudit.setObjName( objName );
for ( String[] op : opArray )
{
uAudit.setOpName( PermTestData.getName( op ) );
List<Mod> mods = auditMgr.searchAdminMods( uAudit );
assertNotNull( mods );
assertTrue(
CLS_NM + "searchAdminMods failed search for successful authentication user ["
+ user.getUserId() + "] object [" + objName + "] operation ["
+ PermTestData.getName( op ) + "]",
mods.size() > 0 || !isAudit( objName, PermTestData.getName( op ) ) );
boolean result = mods.size() > 0 || !isAudit( objName, PermTestData.getName( op ) );
LOG.debug( "searchAdminMods search user [" + user.getUserId() + "] object ["
+ objName + "] operation [" + PermTestData.getName( op ) + "] result: " + result );
//System.out.println("searchAdminMods search user [" + user.getUserId() + "] object [" + objName + "] operation [" + PermTestData.getName(op) + "] result: " + result);
}
}
}
LOG.debug( "searchAdminMods successful" );
}
catch ( SecurityException ex )
{
LOG.error(
"searchAdminMods: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例13: searchAuthZs
import org.apache.directory.fortress.core.model.UserAudit; //导入方法依赖的package包/类
/**
*
* @param msg
* @param uArray
*/
private static void searchAuthZs( String msg, String[][] uArray, String[][] oArray, String[][] opArray,
boolean failedOnly )
{
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 );
for ( String[] obj : oArray )
{
uAudit.setObjName( PermTestData.getName( obj ) );
for ( String[] op : opArray )
{
uAudit.setOpName( PermTestData.getName( op ) );
uAudit.setObjId( PermTestData.getObjId( op ) );
uAudit.setFailedOnly( failedOnly );
List<AuthZ> authZs = auditMgr.searchAuthZs( uAudit );
assertNotNull( authZs );
assertTrue(
CLS_NM + "searchAuthZs failedOnly=" + failedOnly + ", search authorizations user ["
+ user.getUserId() + "], objName [" + uAudit.getObjName() + "], opName [" + uAudit.getOpName() + "], objId [" + uAudit.getObjId() + "]", authZs.size() > 0 );
}
}
}
LOG.debug( "searchAuthZs successful" );
}
catch ( SecurityException ex )
{
LOG.error(
"searchAuthZs: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}