附上了我的上下文提供的SAMLContextProviderLB豆Spring Security的SAML,重定向的頁面,而不是去到HTTP HTTPS的使用SAMLContextProviderLB設置爲https配置
**<property name="scheme" value="https"/>**
<property name="serverName" value="${sp.hostname}"/>
<property name="serverPort" value="#{'${sp.ssl.port}'=='' ? 443 : '${sp.ssl.port}'}"/>
<property name="includeServerPortInRequestURL" value="#{'${sp.ssl.port}'=='443' ? false : true }"/>
<property name="contextPath" value="/${sp.context.root}"/>
我是一個反向代理服務器後面,所以我卸載了SSL終止。後端服務器本身正在偵聽非SSL,但是webtier正在爲我們終止SSL並轉發到非SSL端口。我已經使用上述屬性設置了SAMLContextProviderLB,因此即使後端是https,它也會知道將saml令牌的預期收件人映射爲https受衆。然而,我在下面的日誌中看到,當我訪問受保護的資源時,它在瀏覽器上返回垃圾。當我在瀏覽器中將其更改爲https時,它按預期工作。看到下面的日誌顯示,從DefaultSavedRequest url 返回的值是HTTP,它應該是HTTP。
2016-03-07 18:24:11,907 INFO org.springframework.security.saml.log.SAMLDefaultLogger.log:127 - AuthNResponse; SUCCESS; 10.4.203.88; https://myserver:89/fct;https://www.myADFS.com/adfs/services/trust;[email protected] ;;
2016-03-07 18:24:11,909 DEBUG org.springframework.security.saml.SAMLProcessingFilter.successfulAuthentication:317 - 認證成功。更新SecurityContextHolder以包含:org.springf[email protected]830e9237:Principal:[email protected];證書:[PROTECTED];已驗證:true;詳細信息:null;未授予任何機關
2016年3月7日18:24:11,910 DEBUG org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler.onAuthenticationSuccess:79 - 重定向到DefaultSavedRequest網址:HTTP:// MYSERVER: 89/FCT /頁
2016年3月7日18:24:11911 DEBUG org.springframework.security.web.DefaultRedirectStrategy.sendRedirect:36 - 重定向到 'http://myserver:89/fct/page'
2016年3月7日18: 24:11,911 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository.saveCon文本:292 - SecurityContext存儲到HttpSession:'[email protected]0e9237:身份驗證:org.springf[email protected]830e9237:主體:[email protected];證書:[PROTECTED];已驗證:true;詳細信息:null;未授予任何當局
2016年3月7日18:24:11912 DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter:97 - SecurityContextHolder中已被清除,已完成
任何想法,請求處理如何在此設置下強制使用HTTPS?提前致謝。