Search in sources :

Example 61 with UsernamePasswordCredential

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

the class Cas30ResponseViewTests method verifyPasswordAsAuthenticationAttributeCanDecrypt.

@Test
public void verifyPasswordAsAuthenticationAttributeCanDecrypt() throws Exception {
    final Map<?, ?> attributes = renderView();
    assertTrue(attributes.containsKey(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL));
    final String encodedPsw = (String) attributes.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL);
    final String password = decryptCredential(encodedPsw);
    final UsernamePasswordCredential creds = CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword();
    assertEquals(password, creds.getPassword());
}
Also used : UsernamePasswordCredential(org.apereo.cas.authentication.UsernamePasswordCredential) Test(org.junit.Test)

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