Search in sources :

Example 1 with HttpRequestResponseHolder

use of org.springframework.security.web.context.HttpRequestResponseHolder in project spring-security by spring-projects.

the class SessionManagementConfigServlet31Tests method login.

private void login(Authentication auth) {
    HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
    HttpRequestResponseHolder requestResponseHolder = new HttpRequestResponseHolder(request, response);
    repo.loadContext(requestResponseHolder);
    SecurityContextImpl securityContextImpl = new SecurityContextImpl();
    securityContextImpl.setAuthentication(auth);
    repo.saveContext(securityContextImpl, requestResponseHolder.getRequest(), requestResponseHolder.getResponse());
}
Also used : HttpRequestResponseHolder(org.springframework.security.web.context.HttpRequestResponseHolder) SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) HttpSessionSecurityContextRepository(org.springframework.security.web.context.HttpSessionSecurityContextRepository)

Example 2 with HttpRequestResponseHolder

use of org.springframework.security.web.context.HttpRequestResponseHolder in project spring-security by spring-projects.

the class SessionManagementConfigurerServlet31Tests method login.

private void login(Authentication auth) {
    HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
    HttpRequestResponseHolder requestResponseHolder = new HttpRequestResponseHolder(request, response);
    repo.loadContext(requestResponseHolder);
    SecurityContextImpl securityContextImpl = new SecurityContextImpl();
    securityContextImpl.setAuthentication(auth);
    repo.saveContext(securityContextImpl, requestResponseHolder.getRequest(), requestResponseHolder.getResponse());
}
Also used : HttpRequestResponseHolder(org.springframework.security.web.context.HttpRequestResponseHolder) SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) HttpSessionSecurityContextRepository(org.springframework.security.web.context.HttpSessionSecurityContextRepository)

Aggregations

SecurityContextImpl (org.springframework.security.core.context.SecurityContextImpl)2 HttpRequestResponseHolder (org.springframework.security.web.context.HttpRequestResponseHolder)2 HttpSessionSecurityContextRepository (org.springframework.security.web.context.HttpSessionSecurityContextRepository)2