附上SAMLContextProviderLB bean的上下文提供程序
**<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}"/>
Run Code Online (Sandbox Code Playgroud)
我在反向代理服务器后面,所以我正在卸载SSL终端.后端服务器本身正在侦听非SSL,但是webtier正在为我们终止SSL并转发到非ssl端口.我已经设置了具有上述属性的SAMLContextProviderLB,因此即使后端是https,它也会知道将saml令牌的预期收件人映射为https受众.然而,当我访问受保护资源时,我在下面的日志中看到了它在浏览器上返回的垃圾.当我在浏览器中将其更改为https时,它可以按预期工作.查看下面的日志显示,当 DefaultSavedRequest url 应该是HTTP时,从DefaultSavedRequest url返回的值是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; camachof@email.com ;;
2016-03-07 18:24:11,909 DEBUG org.springframework.security.saml.SAMLProcessingFilter.successfulAuthentication:317 - 身份验证成功.更新SecurityContextHolder以包含:org.springframework.security.providers.ExpiringUsernameAuthenticationToken@830e9237:校长:camachof@email.com; 证书:[保护]; 认证:真实; 细节:null; 没有授予任何权力
2016-03-07 18:24:11,910 DEBUG org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler.onAuthenticationSuccess:79 - 重定向到DefaultSavedRequest网址:http:// myserver:89/fct/page
2016-03-07 18:24:11,911 DEBUG org.springframework.security.web.DefaultRedirectStrategy.sendRedirect:36 - 重定向到' http:// myserver:89/fct/page '
2016-03-07 18:24:11,911 DEBUG …