Search in sources :

Example 1 with MidpointSecurityContext

use of com.evolveum.midpoint.authentication.impl.MidpointSecurityContext in project midpoint by Evolveum.

the class MidpointWebSecurityConfigurerAdapter method createSessionContextRepository.

private void createSessionContextRepository(HttpSecurity http) {
    HttpSessionSecurityContextRepository httpSecurityRepository = new HttpSessionSecurityContextRepository() {

        @Override
        public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) {
            if (!AuthSequenceUtil.isRecordSessionLessAccessChannel(request)) {
                super.saveContext(context, request, response);
            }
        }

        @Override
        protected SecurityContext generateNewContext() {
            return new MidpointSecurityContext(super.generateNewContext(), removeUnusedSecurityFilterPublisher);
        }
    };
    httpSecurityRepository.setDisableUrlRewriting(true);
    AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
    if (trustResolver != null) {
        httpSecurityRepository.setTrustResolver(trustResolver);
    }
    http.setSharedObject(SecurityContextRepository.class, httpSecurityRepository);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) MidpointSecurityContext(com.evolveum.midpoint.authentication.impl.MidpointSecurityContext) HttpSessionSecurityContextRepository(org.springframework.security.web.context.HttpSessionSecurityContextRepository) MidpointSecurityContext(com.evolveum.midpoint.authentication.impl.MidpointSecurityContext) SecurityContext(org.springframework.security.core.context.SecurityContext) HttpServletResponse(javax.servlet.http.HttpServletResponse) AuthenticationTrustResolver(org.springframework.security.authentication.AuthenticationTrustResolver)

Aggregations

MidpointSecurityContext (com.evolveum.midpoint.authentication.impl.MidpointSecurityContext)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 AuthenticationTrustResolver (org.springframework.security.authentication.AuthenticationTrustResolver)1 SecurityContext (org.springframework.security.core.context.SecurityContext)1 HttpSessionSecurityContextRepository (org.springframework.security.web.context.HttpSessionSecurityContextRepository)1