Search in sources :

Example 11 with UsernamePasswordCredential

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

the class FileAuthenticationHandlerTests method verifyFailsUserNotInFileWithDefaultSeparator.

@Test
public void verifyFailsUserNotInFileWithDefaultSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    c.setUsername("fds");
    c.setPassword("rutgers");
    this.thrown.expect(AccountNotFoundException.class);
    this.thrown.expectMessage("fds not found in backing file.");
    this.authenticationHandler.authenticate(c);
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test)

Example 12 with UsernamePasswordCredential

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

the class FileAuthenticationHandlerTests method verifyAuthenticatesUserInFileWithDefaultSeparator.

@Test
public void verifyAuthenticatesUserInFileWithDefaultSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    c.setUsername("scott");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test)

Example 13 with UsernamePasswordCredential

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

the class RejectUsersAuthenticationHandlerTests method verifySupportsProperUserCredentials.

@Test
public void verifySupportsProperUserCredentials() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    c.setUsername("fff");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test)

Example 14 with UsernamePasswordCredential

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

the class RejectUsersAuthenticationHandlerTests method verifyPassesUserNotInMap.

@Test
public void verifyPassesUserNotInMap() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    c.setUsername("fds");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test)

Example 15 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.thrown.expectMessage("hello not found with SQL query.");
    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)61 Test (org.junit.Test)40 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)14 Credential (org.apereo.cas.authentication.Credential)10 HttpBasedServiceCredential (org.apereo.cas.authentication.HttpBasedServiceCredential)9 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)9 Authentication (org.apereo.cas.authentication.Authentication)7 ServiceTicket (org.apereo.cas.ticket.ServiceTicket)7 AuthenticationResult (org.apereo.cas.authentication.AuthenticationResult)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 HashMap (java.util.HashMap)5 DefaultHandlerResult (org.apereo.cas.authentication.DefaultHandlerResult)5 Service (org.apereo.cas.authentication.principal.Service)5 Assertion (org.apereo.cas.validation.Assertion)5 ClassPathResource (org.springframework.core.io.ClassPathResource)5 LinkedHashMap (java.util.LinkedHashMap)4 FailedLoginException (javax.security.auth.login.FailedLoginException)4 BasicCredentialMetaData (org.apereo.cas.authentication.BasicCredentialMetaData)4 DefaultAuthenticationBuilder (org.apereo.cas.authentication.DefaultAuthenticationBuilder)4 AbstractWebApplicationService (org.apereo.cas.authentication.principal.AbstractWebApplicationService)4