use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class PasswordChangeActionTests method verifyFailsValidation.
@Test
public void verifyFailsValidation() throws Exception {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
RequestContextHolder.setRequestContext(context);
ExternalContextHolder.setExternalContext(context.getExternalContext());
WebUtils.putCredential(context, RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
val changeReq = new PasswordChangeRequest();
changeReq.setUsername("casuser");
changeReq.setPassword("123456");
context.getFlowScope().put(PasswordManagementWebflowConfigurer.FLOW_VAR_ID_PASSWORD, changeReq);
assertEquals(CasWebflowConstants.TRANSITION_ID_ERROR, passwordChangeAction.execute(context).getId());
}
use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class GroovyPasswordHistoryServiceTests method verifyValidity.
@Test
public void verifyValidity() {
val request = new PasswordChangeRequest("casuser", "password", "password");
assertFalse(passwordHistoryService.exists(request));
assertTrue(passwordHistoryService.store(request));
assertTrue(passwordHistoryService.fetchAll().isEmpty());
assertTrue(passwordHistoryService.fetch("casuser").isEmpty());
assertDoesNotThrow(new Executable() {
@Override
public void execute() throws Throwable {
passwordHistoryService.remove("casuser");
passwordHistoryService.removeAll();
}
});
}
use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class JdbcPasswordHistoryServiceTests method verifyOperation.
@Test
public void verifyOperation() {
val request = new PasswordChangeRequest("casuser", "password", "password");
assertFalse(passwordHistoryService.exists(request));
assertTrue(passwordHistoryService.store(request));
assertTrue(passwordHistoryService.exists(request));
assertFalse(passwordHistoryService.fetchAll().isEmpty());
assertFalse(passwordHistoryService.fetch("casuser").isEmpty());
passwordHistoryService.remove("casuser");
assertFalse(passwordHistoryService.exists(request));
}
Aggregations