org.springframework.security.web.context.SecurityContextRepository Java Examples
The following examples show how to use
org.springframework.security.web.context.SecurityContextRepository.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JwtContxtConfig.java From onetwo with Apache License 2.0 | 6 votes |
@Bean @Autowired public SecurityContextRepository securityContextRepository(JwtSecurityTokenService jwtTokenService){ JwtSecurityContextRepository jwt = new JwtSecurityContextRepository(); jwt.setJwtTokenService(jwtTokenService); String authName = securityConfig.getJwt().getAuthKey(); if(StringUtils.isBlank(authName)){ authName = securityConfig.getJwt().getAuthHeader(); } jwt.setAuthHeaderName(authName); jwt.setAuthStore(securityConfig.getJwt().getAuthStore()); jwt.setCookieStorer(CookieStorer.builder() .cookieDomain(securityConfig.getCookie().getDomain()) .cookiePath(securityConfig.getCookie().getPath()) .build()); return jwt; }
Example #2
Source File: SessionConfig.java From Spring-Security-Third-Edition with MIT License | 4 votes |
@Bean public SecurityContextRepository securityContextRepository(){ return new HttpSessionSecurityContextRepository(); }
Example #3
Source File: SessionConfig.java From Spring-Security-Third-Edition with MIT License | 4 votes |
@Bean public SessionManagementFilter sessionManagementFilter(SecurityContextRepository securityContextRepository, SessionAuthenticationStrategy sessionAuthenticationStrategy){ return new SessionManagementFilter(securityContextRepository, sessionAuthenticationStrategy); }
Example #4
Source File: TokenAwareSecurityContextRepository.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
TokenAwareSecurityContextRepository( SecurityContextRepository tokenSecurityContextRepository, SecurityContextRepository defaultSecurityContextRepository) { this.tokenSecurityContextRepository = requireNonNull(tokenSecurityContextRepository); this.defaultSecurityContextRepository = requireNonNull(defaultSecurityContextRepository); }
Example #5
Source File: TokenAwareSecurityContextRepository.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
private SecurityContextRepository getSecurityContextRepository(HttpServletRequest request) { boolean hasToken = TokenExtractor.getToken(request) != null; return hasToken ? tokenSecurityContextRepository : defaultSecurityContextRepository; }
Example #6
Source File: MolgenisWebAppSecurityConfig.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
@Bean public SecurityContextRepository securityContextRepository() { return new TokenAwareSecurityContextRepository( new NullSecurityContextRepository(), new HttpSessionSecurityContextRepository()); }