org.springframework.session.web.http.HttpSessionStrategy Java Examples

The following examples show how to use org.springframework.session.web.http.HttpSessionStrategy. 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: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #2
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #3
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #4
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #5
Source File: SmartHttpSessionStrategy.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
private HttpSessionStrategy getStrategy(HttpServletRequest request) {
    String authType = request.getHeader("x-auth-token");
    if (authType == null) {
        return this.browser;
    } else {
        return this.api;
    }
}
 
Example #6
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #7
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #8
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #9
Source File: HttpSessionConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy(){
 HeaderHttpSessionStrategy headerSession = new HeaderHttpSessionStrategy();
 CookieHttpSessionStrategy cookieSession = new CookieHttpSessionStrategy();
 headerSession.setHeaderName("x-auth-token");
 return new SmartHttpSessionStrategy(cookieSession,headerSession);
}
 
Example #10
Source File: SmartHttpSessionStrategy.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
private HttpSessionStrategy getStrategy(HttpServletRequest request) {
    String authType = request.getHeader("x-auth-token");
    if (authType == null) {
        return this.browser;
    } else {
        return this.api;
    }
}
 
Example #11
Source File: CustomizableHttpSessionStrategy.java    From onetwo with Apache License 2.0 5 votes vote down vote up
public HttpSessionStrategy getCurrentStrategy(HttpServletRequest request) {
	String header = request.getHeader(strategyHeaderName);
	SessionStrategies strategy = SessionStrategies.of(header);
	if(SessionStrategies.HEADER.equals(strategy)) {
		return headerStrategy;
	}
	return cookieStrategy;
}
 
Example #12
Source File: BootSpringSessionConfiguration.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty(name=SessionProperties.STRATEGY_KEY, havingValue=SessionProperties.STRATEGE_CUSTOMIZABLE)
public HttpSessionStrategy headerFirst() {
	CustomizableHttpSessionStrategy strategy = new CustomizableHttpSessionStrategy();
	strategy.setStrategyHeaderName(sessionProperties.getStrategyHeaderName());
	strategy.setTokenHeaderName(sessionProperties.getTokenHeaderName());
	return strategy;
}
 
Example #13
Source File: HttpSessionConfig.java    From dpCms with Apache License 2.0 4 votes vote down vote up
@Bean
public HttpSessionStrategy httpSessionStrategy() {
        return new HeaderHttpSessionStrategy(); 
}