use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class PrincipalBearingCredentialsAuthenticationHandlerTests method verifySupports.
@Test
public void verifySupports() {
val credentials = new PrincipalBearingCredential(PrincipalFactoryUtils.newPrincipalFactory().createPrincipal("scott"));
assertTrue(this.handler.supports(credentials));
assertFalse(this.handler.supports(new UsernamePasswordCredential()));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class AcceptUserGraphicsForAuthenticationAction method doExecute.
@Override
public Event doExecute(final RequestContext requestContext) {
val username = requestContext.getRequestParameters().get("username");
WebUtils.putCredential(requestContext, new UsernamePasswordCredential(username, null));
WebUtils.putGraphicalUserAuthenticationUsername(requestContext, username);
return success();
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential 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.authentication.credential.UsernamePasswordCredential 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.authentication.credential.UsernamePasswordCredential 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