Search in sources :

Example 1 with DefaultAuthenticationTransactionManager

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

the class TicketsResourceTests method setUp.

@Before
public void setUp() throws Exception {
    final AuthenticationManager mgmr = mock(AuthenticationManager.class);
    when(mgmr.authenticate(any(AuthenticationTransaction.class))).thenReturn(CoreAuthenticationTestUtils.getAuthentication());
    when(ticketSupport.getAuthenticationFrom(anyString())).thenReturn(CoreAuthenticationTestUtils.getAuthentication());
    this.ticketsResourceUnderTest = new TicketsResource(new DefaultAuthenticationSystemSupport(new DefaultAuthenticationTransactionManager(mgmr), new DefaultPrincipalElectionStrategy()), new DefaultCredentialFactory(), ticketSupport, new WebApplicationServiceFactory(), casMock);
    this.mockMvc = MockMvcBuilders.standaloneSetup(this.ticketsResourceUnderTest).defaultRequest(get("/").contextPath("/cas").contentType(MediaType.APPLICATION_FORM_URLENCODED)).build();
}
Also used : AuthenticationManager(org.apereo.cas.authentication.AuthenticationManager) DefaultPrincipalElectionStrategy(org.apereo.cas.authentication.DefaultPrincipalElectionStrategy) WebApplicationServiceFactory(org.apereo.cas.authentication.principal.WebApplicationServiceFactory) DefaultAuthenticationSystemSupport(org.apereo.cas.authentication.DefaultAuthenticationSystemSupport) AuthenticationTransaction(org.apereo.cas.authentication.AuthenticationTransaction) DefaultAuthenticationTransactionManager(org.apereo.cas.authentication.DefaultAuthenticationTransactionManager) Before(org.junit.Before)

Aggregations

AuthenticationManager (org.apereo.cas.authentication.AuthenticationManager)1 AuthenticationTransaction (org.apereo.cas.authentication.AuthenticationTransaction)1 DefaultAuthenticationSystemSupport (org.apereo.cas.authentication.DefaultAuthenticationSystemSupport)1 DefaultAuthenticationTransactionManager (org.apereo.cas.authentication.DefaultAuthenticationTransactionManager)1 DefaultPrincipalElectionStrategy (org.apereo.cas.authentication.DefaultPrincipalElectionStrategy)1 WebApplicationServiceFactory (org.apereo.cas.authentication.principal.WebApplicationServiceFactory)1 Before (org.junit.Before)1