use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class JdbcPasswordManagementServiceTests method verifyUserPasswordChange.
@Test
public void verifyUserPasswordChange() {
val c = new UsernamePasswordCredential("casuser", "password");
val bean = new PasswordChangeRequest();
bean.setConfirmedPassword("newPassword1");
bean.setUsername(c.getUsername());
bean.setPassword("newPassword1");
assertTrue(passwordChangeService.change(c, bean));
assertFalse(passwordHistoryService.fetch(c.getUsername()).isEmpty());
assertFalse(passwordChangeService.change(c, bean));
}
use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class InMemoryPasswordHistoryServiceTests method verifyValidity.
@Test
public void verifyValidity() {
passwordHistoryService.removeAll();
assertTrue(passwordHistoryService.fetchAll().isEmpty());
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");
assertTrue(passwordHistoryService.fetch("casuser").isEmpty());
}
use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class JsonResourcePasswordManagementServiceTests method verifyPasswordValidationService.
@Test
public void verifyPasswordValidationService() {
val c = new UsernamePasswordCredential("casuser", "password");
val bean = new PasswordChangeRequest();
bean.setUsername(c.getUsername());
bean.setConfirmedPassword("Test1@1234");
bean.setPassword("Test1@1234");
val isValid = passwordValidationService.isValid(c, bean);
assertTrue(isValid);
}
use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class JsonResourcePasswordManagementServiceTests method verifyUserPasswordChangeFail.
@Test
public void verifyUserPasswordChangeFail() {
val c = new UsernamePasswordCredential("casuser", "password");
val bean = new PasswordChangeRequest();
bean.setConfirmedPassword("newPassword");
var res = passwordChangeService.change(c, bean);
assertFalse(res);
bean.setConfirmedPassword("newPassword");
bean.setPassword("unknown");
res = passwordChangeService.change(c, bean);
assertFalse(res);
bean.setPassword(bean.getConfirmedPassword());
c.setUsername(UUID.randomUUID().toString());
res = passwordChangeService.change(c, bean);
assertFalse(res);
}
use of org.apereo.cas.pm.PasswordChangeRequest in project cas by apereo.
the class JsonResourcePasswordManagementServiceTests method verifyUserPasswordChange.
@Test
public void verifyUserPasswordChange() {
val c = new UsernamePasswordCredential("casuser", "password");
val bean = new PasswordChangeRequest();
bean.setConfirmedPassword("newPassword");
bean.setPassword("newPassword");
val res = passwordChangeService.change(c, bean);
assertTrue(res);
}
Aggregations