Search in sources :

Example 1 with NullRequestCache

use of org.springframework.security.web.savedrequest.NullRequestCache in project spring-security by spring-projects.

the class SessionManagementConfigurer method init.

@Override
public void init(H http) throws Exception {
    SecurityContextRepository securityContextRepository = http.getSharedObject(SecurityContextRepository.class);
    boolean stateless = isStateless();
    if (securityContextRepository == null) {
        if (stateless) {
            http.setSharedObject(SecurityContextRepository.class, new NullSecurityContextRepository());
        } else {
            HttpSessionSecurityContextRepository httpSecurityRepository = new HttpSessionSecurityContextRepository();
            httpSecurityRepository.setDisableUrlRewriting(!this.enableSessionUrlRewriting);
            httpSecurityRepository.setAllowSessionCreation(isAllowSessionCreation());
            AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
            if (trustResolver != null) {
                httpSecurityRepository.setTrustResolver(trustResolver);
            }
            http.setSharedObject(SecurityContextRepository.class, httpSecurityRepository);
        }
    }
    RequestCache requestCache = http.getSharedObject(RequestCache.class);
    if (requestCache == null) {
        if (stateless) {
            http.setSharedObject(RequestCache.class, new NullRequestCache());
        }
    }
    http.setSharedObject(SessionAuthenticationStrategy.class, getSessionAuthenticationStrategy(http));
    http.setSharedObject(InvalidSessionStrategy.class, getInvalidSessionStrategy());
}
Also used : HttpSessionSecurityContextRepository(org.springframework.security.web.context.HttpSessionSecurityContextRepository) NullSecurityContextRepository(org.springframework.security.web.context.NullSecurityContextRepository) RequestCache(org.springframework.security.web.savedrequest.RequestCache) NullRequestCache(org.springframework.security.web.savedrequest.NullRequestCache) AuthenticationTrustResolver(org.springframework.security.authentication.AuthenticationTrustResolver) NullSecurityContextRepository(org.springframework.security.web.context.NullSecurityContextRepository) HttpSessionSecurityContextRepository(org.springframework.security.web.context.HttpSessionSecurityContextRepository) SecurityContextRepository(org.springframework.security.web.context.SecurityContextRepository) NullRequestCache(org.springframework.security.web.savedrequest.NullRequestCache)

Aggregations

AuthenticationTrustResolver (org.springframework.security.authentication.AuthenticationTrustResolver)1 HttpSessionSecurityContextRepository (org.springframework.security.web.context.HttpSessionSecurityContextRepository)1 NullSecurityContextRepository (org.springframework.security.web.context.NullSecurityContextRepository)1 SecurityContextRepository (org.springframework.security.web.context.SecurityContextRepository)1 NullRequestCache (org.springframework.security.web.savedrequest.NullRequestCache)1 RequestCache (org.springframework.security.web.savedrequest.RequestCache)1