Package org.springframework.security.web.context

Examples of org.springframework.security.web.context.HttpSessionSecurityContextRepository


        this.context = new InMemoryXmlApplicationContext(context);
        this.springSecurityFilterChain = this.context.getBean("springSecurityFilterChain",Filter.class);
    }

    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());
    }
View Full Code Here


                    .withUser("user").password("password").roles("USER");
        }

        @Bean
        public SecurityContextRepository securityContextRepository() {
            HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
            repo.setSpringSecurityContextKey("CUSTOM");
            return repo;
        }
View Full Code Here

        if(securityContextRepository == null) {
            if(stateless) {
                http.setSharedObject(SecurityContextRepository.class, new NullSecurityContextRepository());
            } else {
                HttpSessionSecurityContextRepository httpSecurityRepository = new HttpSessionSecurityContextRepository();
                httpSecurityRepository.setDisableUrlRewriting(!enableSessionUrlRewriting);
                httpSecurityRepository.setAllowSessionCreation(isAllowSessionCreation());
                AuthenticationTrustResolver trustResolver = http.getSharedObject(AuthenticationTrustResolver.class);
                if(trustResolver != null) {
                    httpSecurityRepository.setTrustResolver(trustResolver);
                }
                http.setSharedObject(SecurityContextRepository.class, httpSecurityRepository);
            }
        }
View Full Code Here

        this.context = context;
        this.springSecurityFilterChain = this.context.getBean("springSecurityFilterChain",Filter.class);
    }

    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());
    }
View Full Code Here

  /**
   * Creates a new AjaxSessionFilter instance with a default HttpSessionSecurityContextRepository set
   */
  public AjaxSessionFilter() {
    super(new HttpSessionSecurityContextRepository());
  }
View Full Code Here

        if(securityContextRepository == null) {
            if(stateless) {
                builder.setSharedObject(SecurityContextRepository.class, new NullSecurityContextRepository());
            } else {
                HttpSessionSecurityContextRepository httpSecurityRepository = new HttpSessionSecurityContextRepository();
                httpSecurityRepository.setDisableUrlRewriting(!enableSessionUrlRewriting);
                httpSecurityRepository.setAllowSessionCreation(isAllowSessionCreation());
                builder.setSharedObject(SecurityContextRepository.class, httpSecurityRepository);
            }
        }

        RequestCache requestCache = builder.getSharedObject(RequestCache.class);
View Full Code Here

       
       
        SecurityContextPersistenceFilterConfig pConfig =
                (SecurityContextPersistenceFilterConfig) config;
               
        HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
        SecurityContextPersistenceFilter filter = new SecurityContextPersistenceFilter(repo) {
          @Override
        public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
                throws IOException, ServletException {
                 // set the hint for authentcation servlets
                 req.setAttribute(ALLOWSESSIONCREATION_ATTR, isAllowSessionCreation);
                 if (isAllowSessionCreation)
                     ((HttpServletRequest)req).getSession(); // create session if allowed
                 // set the hint for other components
                 req.setAttribute(GeoServerSecurityFilterChainProxy.SECURITY_ENABLED_ATTRIBUTE,Boolean.TRUE);
                 super.doFilter(req, res, chain);
       
        };
        isAllowSessionCreation=pConfig.isAllowSessionCreation();
        repo.setAllowSessionCreation(pConfig.isAllowSessionCreation());       
        filter.setForceEagerSessionCreation(false);

        try {
            filter.afterPropertiesSet();
        } catch (ServletException e) {
View Full Code Here

        return logoutFilter;
    }

    @Bean
    public Filter securityContextPersistenceFilter() {
        HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
        repo.setSpringSecurityContextKey(keyWithNamespace(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY));
        return new SecurityContextPersistenceFilter(repo);
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.web.context.HttpSessionSecurityContextRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.