org.springframework.session.web.http.CookieSerializer Java Examples
The following examples show how to use
org.springframework.session.web.http.CookieSerializer.
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: FixSpringSessionCookieSerializerConfiguration.java From onetwo with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(CookieSerializer.class) public CookieSerializer cookieSerializer(){ DefaultCookieSerializer serializer = new DefaultCookieSerializer(); CookieConfig cookieConfig = securityConfig.getCookie(); // if(StringUtils.isNotBlank(cookieConfig.getPath())){ serializer.setCookiePath(cookieConfig.getPath()); // } if(StringUtils.isNotBlank(cookieConfig.getDomain())){ serializer.setDomainName(cookieConfig.getDomain()); } serializer.setCookieName(cookieConfig.getName()); return serializer; }
Example #2
Source File: Config.java From spring-session with Apache License 2.0 | 5 votes |
@Bean public CookieSerializer cookieSerializer() { DefaultCookieSerializer serializer = new DefaultCookieSerializer(); serializer.setCookieName("JSESSIONID"); // <1> serializer.setCookiePath("/"); // <2> serializer.setDomainNamePattern("^.+?\\.(\\w+\\.[a-z]+)$"); // <3> return serializer; }
Example #3
Source File: SpringHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 5 votes |
private CookieSerializer createDefaultCookieSerializer() { DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); if (this.servletContext != null) { SessionCookieConfig sessionCookieConfig = null; try { sessionCookieConfig = this.servletContext.getSessionCookieConfig(); } catch (UnsupportedOperationException ex) { this.logger.warn("Unable to obtain SessionCookieConfig: " + ex.getMessage()); } if (sessionCookieConfig != null) { if (sessionCookieConfig.getName() != null) { cookieSerializer.setCookieName(sessionCookieConfig.getName()); } if (sessionCookieConfig.getDomain() != null) { cookieSerializer.setDomainName(sessionCookieConfig.getDomain()); } if (sessionCookieConfig.getPath() != null) { cookieSerializer.setCookiePath(sessionCookieConfig.getPath()); } if (sessionCookieConfig.getMaxAge() != -1) { cookieSerializer.setCookieMaxAge(sessionCookieConfig.getMaxAge()); } } } if (this.usesSpringSessionRememberMeServices) { cookieSerializer.setRememberMeRequestAttribute(SpringSessionRememberMeServices.REMEMBER_ME_LOGIN_ATTR); } return cookieSerializer; }
Example #4
Source File: SessionConfig.java From retro-game with GNU Affero General Public License v3.0 | 4 votes |
@Bean public CookieSerializer cookieSerializer() { DefaultCookieSerializer serializer = new DefaultCookieSerializer(); serializer.setCookieName("s"); return serializer; }
Example #5
Source File: SpringHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 4 votes |
@PostConstruct public void init() { CookieSerializer cookieSerializer = (this.cookieSerializer != null) ? this.cookieSerializer : createDefaultCookieSerializer(); this.defaultHttpSessionIdResolver.setCookieSerializer(cookieSerializer); }
Example #6
Source File: SpringHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 4 votes |
@Autowired(required = false) public void setCookieSerializer(CookieSerializer cookieSerializer) { this.cookieSerializer = cookieSerializer; }
Example #7
Source File: EnableSpringHttpSessionCustomCookieSerializerTests.java From spring-session with Apache License 2.0 | 4 votes |
@Bean CookieSerializer cookieSerializer() { return mock(CookieSerializer.class); }