Search in sources :

Example 26 with UsernamePasswordCredential

use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.

the class JsonResourcePasswordManagementServiceTests method verifyPasswordValidationService.

@Test
public void verifyPasswordValidationService() {
    final UsernamePasswordCredential c = new UsernamePasswordCredential("casuser", "password");
    final PasswordChangeBean bean = new PasswordChangeBean();
    bean.setConfirmedPassword("Test@1234");
    bean.setPassword("Test@1234");
    final boolean isValid = passwordValidationService.isValid(c, bean);
    assertTrue(isValid);
}
Also used : PasswordChangeBean(org.apereo.cas.pm.PasswordChangeBean) UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 27 with UsernamePasswordCredential

use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.

the class JsonResourcePasswordManagementServiceTests method verifyUserPasswordChange.

@Test
public void verifyUserPasswordChange() {
    final Credential c = new UsernamePasswordCredential("casuser", "password");
    final PasswordChangeBean bean = new PasswordChangeBean();
    bean.setConfirmedPassword("newPassword");
    bean.setPassword("newPassword");
    final boolean res = passwordChangeService.change(c, bean);
    assertTrue(res);
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Credential(org.apereo.cas.authentication.Credential) PasswordChangeBean(org.apereo.cas.pm.PasswordChangeBean) UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 28 with UsernamePasswordCredential

use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.

the class SamlAuthenticationMetaDataPopulatorTests method verifyAuthenticationTypeFound.

@Test
public void verifyAuthenticationTypeFound() {
    final UsernamePasswordCredential credentials = new UsernamePasswordCredential();
    final AuthenticationBuilder builder = CoreAuthenticationTestUtils.getAuthenticationBuilder();
    this.populator.populateAttributes(builder, AuthenticationTransaction.of(credentials));
    final Authentication auth = builder.build();
    assertEquals(SamlAuthenticationMetaDataPopulator.AUTHN_METHOD_PASSWORD, auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD));
}
Also used : AuthenticationBuilder(org.apereo.cas.authentication.AuthenticationBuilder) Authentication(org.apereo.cas.authentication.Authentication) UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test)

Example 29 with UsernamePasswordCredential

use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.

the class JdbcThrottledSubmissionHandlerInterceptorAdapterTests method badCredentials.

private static UsernamePasswordCredential badCredentials(final String username) {
    final UsernamePasswordCredential credentials = new UsernamePasswordCredential();
    credentials.setUsername(username);
    credentials.setPassword("badpassword");
    return credentials;
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential)

Example 30 with UsernamePasswordCredential

use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.

the class SearchModeSearchDatabaseAuthenticationHandlerTests method verifyNotFoundUser.

@Test
public void verifyNotFoundUser() throws Exception {
    final UsernamePasswordCredential c = CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("hello", "world");
    this.thrown.expect(FailedLoginException.class);
    this.handler.authenticate(c);
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

UsernamePasswordCredential (org.apereo.cas.authentication.UsernamePasswordCredential)96 Test (org.junit.Test)58 Credential (org.apereo.cas.authentication.Credential)25 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)22 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)17 HashMap (java.util.HashMap)10 LinkedHashMap (java.util.LinkedHashMap)9 CachedData (net.spy.memcached.CachedData)9 Authentication (org.apereo.cas.authentication.Authentication)9 AuthenticationResult (org.apereo.cas.authentication.AuthenticationResult)9 HttpBasedServiceCredential (org.apereo.cas.authentication.HttpBasedServiceCredential)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 Service (org.apereo.cas.authentication.principal.Service)8 ServiceTicket (org.apereo.cas.ticket.ServiceTicket)8 BasicCredentialMetaData (org.apereo.cas.authentication.BasicCredentialMetaData)6 DefaultAuthenticationBuilder (org.apereo.cas.authentication.DefaultAuthenticationBuilder)6 Assertion (org.apereo.cas.validation.Assertion)6 AuthenticationBuilder (org.apereo.cas.authentication.AuthenticationBuilder)5 PasswordChangeBean (org.apereo.cas.pm.PasswordChangeBean)5 ClassPathResource (org.springframework.core.io.ClassPathResource)5