Search in sources :

Example 1 with HttpSessionFactory

use of ddf.security.http.impl.HttpSessionFactory in project ddf by codice.

the class AuthenticationEndpointTest method setup.

@Before
public void setup() throws SecurityServiceException, URISyntaxException {
    HttpSessionFactory sessionFactory = mock(HttpSessionFactory.class);
    HttpSession session = mock(HttpSession.class);
    when(session.getAttribute(SecurityConstants.SAML_ASSERTION)).thenReturn(mock(SecurityTokenHolder.class));
    when(sessionFactory.getOrCreateSession(any())).thenReturn(session);
    policyManager = mock(ContextPolicyManager.class);
    securityManager = mock(SecurityManager.class);
    authEndpoint = new AuthenticationEndpoint(policyManager, securityManager, sessionFactory);
    UriInfo uriInfo = mock(UriInfo.class);
    UriBuilder uriBuilder = mock(UriBuilder.class);
    when(uriInfo.getBaseUriBuilder()).thenReturn(uriBuilder);
    when(uriBuilder.replacePath(anyString())).thenReturn(uriBuilder);
    when(uriBuilder.build()).thenReturn(new URI(URL));
    authEndpoint.uriInfo = uriInfo;
    mockUser(USER_NAME, PASSWORD, REALM);
}
Also used : SecurityTokenHolder(ddf.security.common.SecurityTokenHolder) SecurityManager(ddf.security.service.SecurityManager) HttpSession(javax.servlet.http.HttpSession) HttpSessionFactory(ddf.security.http.impl.HttpSessionFactory) UriBuilder(javax.ws.rs.core.UriBuilder) URI(java.net.URI) UriInfo(javax.ws.rs.core.UriInfo) ContextPolicyManager(org.codice.ddf.security.policy.context.ContextPolicyManager) Before(org.junit.Before)

Aggregations

SecurityTokenHolder (ddf.security.common.SecurityTokenHolder)1 HttpSessionFactory (ddf.security.http.impl.HttpSessionFactory)1 SecurityManager (ddf.security.service.SecurityManager)1 URI (java.net.URI)1 HttpSession (javax.servlet.http.HttpSession)1 UriBuilder (javax.ws.rs.core.UriBuilder)1 UriInfo (javax.ws.rs.core.UriInfo)1 ContextPolicyManager (org.codice.ddf.security.policy.context.ContextPolicyManager)1 Before (org.junit.Before)1