Search in sources :

Example 26 with DefaultAuthenticationTransactionFactory

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

the class WsFederationCredentialsToPrincipalResolverCasResolutionTests method verifyAuth.

@Test
public void verifyAuth() {
    val creds = getCredential();
    val auth = authenticationManager.authenticate(new DefaultAuthenticationTransactionFactory().newTransaction(creds));
    assertNotNull(auth);
}
Also used : lombok.val(lombok.val) DefaultAuthenticationTransactionFactory(org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory) Test(org.junit.jupiter.api.Test)

Example 27 with DefaultAuthenticationTransactionFactory

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

the class WsFederationCredentialsToPrincipalResolverAllResolutionTests method verifyAuth.

@Test
public void verifyAuth() {
    val creds = getCredential();
    val auth = authenticationManager.authenticate(new DefaultAuthenticationTransactionFactory().newTransaction(creds));
    assertNotNull(auth);
}
Also used : lombok.val(lombok.val) DefaultAuthenticationTransactionFactory(org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory) Test(org.junit.jupiter.api.Test)

Example 28 with DefaultAuthenticationTransactionFactory

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

the class WsFederationCredentialsToPrincipalResolverTests method verifyAuth.

@Test
public void verifyAuth() {
    val creds = getCredential();
    val auth = authenticationManager.authenticate(new DefaultAuthenticationTransactionFactory().newTransaction(creds));
    assertNotNull(auth);
}
Also used : lombok.val(lombok.val) DefaultAuthenticationTransactionFactory(org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory) Test(org.junit.jupiter.api.Test)

Example 29 with DefaultAuthenticationTransactionFactory

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

the class X509SubjectDNPrincipalResolverAggregateTests method verifyResolverAsAggregate.

@Test
public void verifyResolverAsAggregate() {
    val c = new X509CertificateCredential(new X509Certificate[] { VALID_CERTIFICATE });
    c.setCertificate(VALID_CERTIFICATE);
    val result = authenticationManager.authenticate(new DefaultAuthenticationTransactionFactory().newTransaction(c));
    assertNotNull(result);
    val attributes = result.getPrincipal().getAttributes();
    assertTrue(attributes.containsKey("subjectX500Principal"));
    assertTrue(attributes.containsKey("groovySubjectX500Principal"));
}
Also used : lombok.val(lombok.val) X509CertificateCredential(org.apereo.cas.adaptors.x509.authentication.principal.X509CertificateCredential) DefaultAuthenticationTransactionFactory(org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 30 with DefaultAuthenticationTransactionFactory

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

the class CredentialsAsFirstParameterResourceResolverTests method verifyTransaction.

@Test
public void verifyTransaction() {
    val resolver = new CredentialsAsFirstParameterResourceResolver();
    val jp = mock(JoinPoint.class);
    when(jp.getArgs()).thenReturn(new Object[] { new DefaultAuthenticationTransactionFactory().newTransaction(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword("casuser")) });
    assertNotNull(resolver.resolveFrom(jp, new Object()));
}
Also used : lombok.val(lombok.val) DefaultAuthenticationTransactionFactory(org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)33 DefaultAuthenticationTransactionFactory (org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory)33 Test (org.junit.jupiter.api.Test)27 DefaultAuthenticationServiceSelectionPlan (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan)9 DefaultAuthenticationServiceSelectionStrategy (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy)9 RegisteredServiceAuthenticationPolicyResolver (org.apereo.cas.authentication.policy.RegisteredServiceAuthenticationPolicyResolver)7 SimpleTestUsernamePasswordAuthenticationHandler (org.apereo.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler)5 DefaultAuthenticationResultBuilderFactory (org.apereo.cas.authentication.DefaultAuthenticationResultBuilderFactory)4 DefaultAuthenticationSystemSupport (org.apereo.cas.authentication.DefaultAuthenticationSystemSupport)4 DefaultAuthenticationTransactionManager (org.apereo.cas.authentication.DefaultAuthenticationTransactionManager)4 DefaultPrincipalElectionStrategy (org.apereo.cas.authentication.principal.DefaultPrincipalElectionStrategy)4 UsernamePasswordCredential (org.apereo.cas.authentication.credential.UsernamePasswordCredential)3 WebApplicationServiceFactory (org.apereo.cas.authentication.principal.WebApplicationServiceFactory)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 HashMap (java.util.HashMap)2 AuthenticationTransaction (org.apereo.cas.authentication.AuthenticationTransaction)2 RegisteredServiceAuthenticationHandlerResolver (org.apereo.cas.authentication.handler.RegisteredServiceAuthenticationHandlerResolver)2 AtLeastOneCredentialValidatedAuthenticationPolicy (org.apereo.cas.authentication.policy.AtLeastOneCredentialValidatedAuthenticationPolicy)2 UsernamePasswordRestHttpRequestCredentialFactory (org.apereo.cas.rest.factory.UsernamePasswordRestHttpRequestCredentialFactory)2