本文整理汇总了Java中org.apache.directory.fortress.core.PwPolicyMgr类的典型用法代码示例。如果您正苦于以下问题:Java PwPolicyMgr类的具体用法?Java PwPolicyMgr怎么用?Java PwPolicyMgr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PwPolicyMgr类属于org.apache.directory.fortress.core包,在下文中一共展示了PwPolicyMgr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createResponse
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* ************************************************************************************************************************************
* BEGIN PSWDPOLICYMGR
* **************************************************************************************************************************************
*/
/* No qualifier */ FortResponse addPolicy( FortRequest request )
{
FortResponse response = createResponse();
try
{
PwPolicy inPolicy = (PwPolicy) request.getEntity();
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
policyMgr.add( inPolicy );
response.setEntity( inPolicy );
}
catch ( SecurityException se )
{
createError( response, LOG, se );
}
return response;
}
示例2: updatePolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
FortResponse updatePolicy( FortRequest request )
{
FortResponse response = createResponse();
try
{
PwPolicy inPolicy = (PwPolicy) request.getEntity();
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
policyMgr.update( inPolicy );
response.setEntity( inPolicy );
}
catch ( SecurityException se )
{
createError( response, LOG, se );
}
return response;
}
示例3: deletePolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
FortResponse deletePolicy( FortRequest request )
{
FortResponse response = createResponse();
try
{
PwPolicy inPolicy = (PwPolicy) request.getEntity();
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
policyMgr.delete( inPolicy );
response.setEntity( inPolicy );
}
catch ( SecurityException se )
{
createError( response, LOG, se );
}
return response;
}
示例4: readPolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
FortResponse readPolicy( FortRequest request )
{
FortResponse response = createResponse();
PwPolicy outPolicy;
try
{
PwPolicy inPolicy = (PwPolicy) request.getEntity();
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
outPolicy = policyMgr.read( inPolicy.getName() );
response.setEntity( outPolicy );
}
catch ( SecurityException se )
{
response.setErrorCode( se.getErrorId() );
response.setErrorMessage( se.getMessage() );
}
return response;
}
示例5: searchPolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
FortResponse searchPolicy( FortRequest request )
{
FortResponse response = createResponse();
List<PwPolicy> policyList;
try
{
PwPolicy inPolicy = (PwPolicy) request.getEntity();
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
policyList = policyMgr.search( inPolicy.getName() );
response.setEntities( policyList );
}
catch ( SecurityException se )
{
response.setErrorCode( se.getErrorId() );
response.setErrorMessage( se.getMessage() );
}
return response;
}
示例6: updateUserPolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
FortResponse updateUserPolicy( FortRequest request )
{
FortResponse response = createResponse();
try
{
PwPolicy inPolicy = (PwPolicy) request.getEntity();
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
String userId = request.getValue();
policyMgr.updateUserPolicy( userId, inPolicy.getName() );
}
catch ( SecurityException se )
{
createError( response, LOG, se );
}
return response;
}
示例7: deleteUserPolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
FortResponse deleteUserPolicy( FortRequest request )
{
FortResponse response = createResponse();
try
{
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( request.getContextId() );
policyMgr.setAdmin( request.getSession() );
String userId = request.getValue();
policyMgr.deletePasswordPolicy( userId );
}
catch ( SecurityException se )
{
createError( response, LOG, se );
}
return response;
}
示例8: checkQuality
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* PT14
* 5.2.5 pwdCheckQuality
* <p>
* This attribute indicates how the password quality will be verified
* while being modified or added. If this attribute is not present, or
* if the value is '0', quality checking will not be enforced. A value
* of '1' indicates that the server will check the quality, and if the
* server is unable to check it (due to a hashed password or other
* reasons) it will be accepted. A value of '2' indicates that the
* server will check the quality, and if the server is unable to verify
* it, it will return an error refusing the password.
*
* @param msg
* @param pArray
*/
public void checkQuality( String msg, String[][] pArray )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
for ( String[] plcy : pArray )
{
PwPolicy policy = PolicyTestData.getPolicy( plcy );
policyMgr.add( policy );
LOG.debug( "checkQuality name [" + policy.getName() + "] successful" );
}
}
catch ( SecurityException ex )
{
LOG.error(
"checkQuality caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(),
ex );
fail( ex.getMessage() );
}
}
示例9: add
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param pArray
*/
public static void add( String msg, String[][] pArray, boolean nofail )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
for ( String[] plcy : pArray )
{
PwPolicy policy = PolicyTestData.getPolicy( plcy );
policyMgr.add( policy );
LOG.debug( "add name [" + policy.getName() + "] successful" );
}
}
catch ( SecurityException ex )
{
if(!nofail)
{
LOG.error( "add caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
}
示例10: update
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param pArray
*/
public void update( String msg, String[][] pArray )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
for ( String[] plcy : pArray )
{
PwPolicy policy = PolicyTestData.getPolicy( plcy );
policyMgr.update( policy );
LOG.debug( "update name [" + policy.getName() + "] successful" );
}
}
catch ( SecurityException ex )
{
LOG.error( "update caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(),
ex );
fail( ex.getMessage() );
}
}
示例11: delete
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param pArray
*/
public void delete( String msg, String[][] pArray )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
for ( String[] plcy : pArray )
{
PwPolicy policy = PolicyTestData.getPolicy( plcy );
policyMgr.delete( policy );
LOG.debug( "deleteRecursive name [" + PolicyTestData.getName( plcy ) + "] successful" );
}
}
catch ( SecurityException ex )
{
LOG.error(
"deleteRecursive caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(),
ex );
fail( ex.getMessage() );
}
}
示例12: read
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param pArray
*/
public void read( String msg, String[][] pArray )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = PwPolicyMgrFactory.createInstance( TestUtils.getContext() );
for ( String[] plcy : pArray )
{
PwPolicy entity = policyMgr.read( PolicyTestData.getName( plcy ) );
PolicyTestData.assertEquals( entity, plcy );
}
}
catch ( SecurityException ex )
{
LOG.error( "read caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例13: updatePasswordPolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param uArray
* @param pArray
*/
public void updatePasswordPolicy( String msg, String[][] uArray, String[][] pArray )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
int i = 0;
for ( String[] plcy : pArray )
{
policyMgr.updateUserPolicy( UserTestData.getUserId( uArray[i++] ), PolicyTestData.getName( plcy ) );
}
}
catch ( SecurityException ex )
{
LOG.error(
"updateUserPolicy caught SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例14: deletePasswordPolicy
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param uArray
*/
public void deletePasswordPolicy( String msg, String[][] uArray )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
for ( String[] usr : uArray )
{
policyMgr.deletePasswordPolicy( UserTestData.getUserId( usr ) );
}
}
catch ( SecurityException ex )
{
LOG.error(
"deletePasswordPolicy caught SecurityException rc=" + ex.getErrorId() + ", msg="
+ ex.getMessage(), ex );
fail( ex.getMessage() );
}
}
示例15: authenticateResetUsers
import org.apache.directory.fortress.core.PwPolicyMgr; //导入依赖的package包/类
/**
* @param msg
* @param uArray
*/
private static void authenticateResetUsers( String msg, String[][] uArray, String[] plcy )
{
LogUtil.logIt( msg );
try
{
AccessMgr accessMgr = AccessMgrFactory.createInstance( TestUtils.getContext() );
PwPolicyMgr policyMgr = PswdPolicyMgrImplTest.getManagedPswdMgr();
for ( String[] usr : uArray )
{
User user = UserTestData.getUser( usr );
// update this user with pw policy that requires change after reset:
policyMgr.updateUserPolicy( user.getUserId(), PolicyTestData.getName( plcy ) );
// now try negative test case:
try
{
accessMgr.authenticate( user.getUserId(), user.getPassword() );
//accessMgr.authenticate( user.getUserId(), user.getPassword() );
fail( CLS_NM + ".authenticateResetUsers failed test" );
}
catch ( SecurityException se )
{
assertTrue( CLS_NM + "authenticateResetUsers reset excep id check",
se.getErrorId() == GlobalErrIds.USER_PW_RESET );
// pass
}
}
LOG.debug( "authenticateResetUsers successful" );
}
catch ( SecurityException ex )
{
LOG.error( "authenticateResetUsers: failed with SecurityException rc=" + ex.getErrorId()
+ ", msg=" + ex.getMessage(), ex );
fail( ex.getMessage() );
}
}