2014-12-04 2 views
0

나는 내 SpringBoot 앱에 Redis와의 Spring Session를 통합했다. 쿠키 도메인 속성을 제외한 모든 것이 잘 작동하는 것 같습니다. 방금 tomcat, 즉 "setSessionCookieDomain"메소드의 쿠키 세션 도메인 속성을 설정하는 방법을 찾았지만 작동하지 않습니다. 예를 들면. 쿠키의 도메인 속성과 같은 tomcat 컨텍스트에서 도메인 속성을 구성했습니다.스프링 세션 1.0.0.M1 쿠키 도메인 속성

@Bean 
    public TomcatContextCustomizer tomcatContextCustomizer() { 
     System.out.println("TOMCATCONTEXTCUSTOMIZER INITILIZED"); 
     return new TomcatContextCustomizer() { 

      @Override 
      public void customize(Context context) { 
       context.addServletContainerInitializer(new WsSci(), null); 
       context.setUseHttpOnly(true); 
       context.setPath("/"); 
       context.setSessionCookiePath("/"); 
       context.setSessionCookieDomain(".127.0.0.5"); 
//    context.setSessionCookieDomain(".localhost"); 
//    context.setSessionCookieDomain(".test.blabla.com"); 

      }   

     }; 
    } 

wireshark에서 https 추적을 열고 follow ssl stream을 클릭하면 다음과 같이 표시됩니다. 다른 모든 속성은 도메인을 제외하고 나열됩니다. 그래서 내 질문은 스프링 세션 1.0.0.M1에서 도메인 속성을 올바르게 설정하는 것입니다. 스프링 세션이 어떻게 든 tomcat 컨텍스트를 재정의합니까?

GET/HTTP/1.1 
Host: 127.0.0.5:8888 
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Lang: keep-alive 

: keep-alive 

: keep-alive 

: keep-alive 

: keep-alive 

HTTP/1.1 200 OK 
Server: Apache-Coyote/1.1 
X-Content-Type-Options: nosniff 
X-XSS-Protection: 1; mode=block 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate 
Pragma: no-cache 
Expires: 0 
Strict-Transport-Security: max-age=31536000 ; includeSubDomains 
X-Frame-Options: DENY 
X-Content-Security-Policy: script-src 'self'; object-src 'self' 
Content-Security-Policy: script-src 'self'; object-src 'self' 
X-WebKit-CSP: default-src 'self' 
X-Application-Context: application:Production 
Set-Cookie: SESSION=5d0a738f-f011-4e43-a1ee-d691b8eba94c; Path=/; Secure; HttpOnly 
Content-Type: text/html;charset=UTF-8 
Conten10:01:27 GMT 

10:01:27 GMT 

10:01:27 GMT 

10:01:27 GMT 

10:01:27 GMT 

<!DOCTYPE html> 

답변

2

감사합니다. Spring Session은 SessionCookieConfig를 통해 도메인을 구성 할 수 있어야하지만하지 않습니다. 이 문제를 해결하기 위해 gh-87을 만들었습니다.

+0

Rob, 질문에 대한 답변을 얻었 기 때문에 기쁩니다. – Tito

관련 문제