/**
* @param alias
* the alias
* @param password
* the password
* @param email
* the email
* @throws Exception
* in case of an error
*/
@BeforeClass(dependsOnGroups = "integration-test-setup")
public void init() throws Exception {
UserVO userVO = TestUtils.createKenmeiUserVO(TestUtils.createRandomUserAlias(),
UserRole.ROLE_KENMEI_USER);
userVO.setPassword("123456");
AuthenticationTestUtils.setManagerContext();
userManagement.createUser(userVO, false, false);
Map<ClientConfigurationPropertyConstant, String> map;
map = new HashMap<ClientConfigurationPropertyConstant, String>();
// set lower limit for getting permanently locked (to speed up test)
map.put(ClientPropertySecurity.FAILED_AUTH_LIMIT_PERMLOCK, String.valueOf(6));
// set shorter wait time for temporarily locked users
map.put(ClientPropertySecurity.FAILED_AUTH_LOCKED_TIMESPAN, String.valueOf(3));
CommunoteRuntime.getInstance().getConfigurationManager()
.updateClientConfigurationProperties(map);
AuthenticationTestUtils.setAuthentication(null);
// initiate authenticationManager
ArrayList<AuthenticationProvider> providers = new ArrayList<>();
providers.add(new DatabaseAuthenticationProvider());
ProviderManager providerManager = new ProviderManager(providers);
providerManager.setAuthenticationEventPublisher(new AuthenticationFailedEventPublisher());
authManager = providerManager;
// create valid user + password-token
validAuth = new UsernamePasswordAuthenticationToken(userVO.getAlias(),
userVO.getPassword());
// create invalid user + password-token
invalidAuth = new UsernamePasswordAuthenticationToken(userVO.getAlias(),
userVO.getPassword() + "invalid");
}
AuthenticationFailedLockoutTest.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:communote-server
作者:
评论列表
文章目录