我有一个Grails应用程序使用在负载均衡器后面的AWS机器上运行的Spring Security Core.
负载均衡器解密ssl连接并转发到我们实例的端口8080,添加适当的X-Forwarded-Proto报头.
我想任何直接访问安全页面使用https重定向到登录页面.
例如,请求https://myapp.com/private/page应重定向到https://myapp.com/login/auth
我把它放在我的config.groovy中:
grails.plugin.springsecurity.secureChannel.definition = [
'/login/**': 'REQUIRES_SECURE_CHANNEL'
]
Run Code Online (Sandbox Code Playgroud)
但这导致重定向循环(HTTP代码302)到http登录页面(http://myapp.com/login/auth)
然后我尝试了:
grails.plugin.springsecurity.secureChannel.useHeaderCheckChannelSecurity = true
grails.plugin.springsecurity.auth.forceHttps = true
Run Code Online (Sandbox Code Playgroud)
但这导致重定向(HTTP代码302)到http登录页面(http://myapp.com/login/auth)
没有运气潜伏在类似的帖子,任何想法?
我们有一个基于Spring 1.6.3的Java 1.6上的应用程序,它使用Spring Security 3.0.5并使用Spring Web和RestEasy 2.1.0实现REST API.我需要将此应用程序(服务器)置于代理之后,该代理将HTTPS请求流量从REST API客户端应用程序转换为HTTP流量.此更改为登录请求创建"跨域"方案:客户端发送HTTPS登录请求,服务器使用HTTP的重定向URL进行应答.目前它回复:
”http://192.168.0.10:8090/index.html;jsessionid=64FD79...86D”,
我需要的是:
”/index.html;jsessionid=64FD79...86D”
我们提供了解决方案,使服务器响应"相对"URL而不是"绝对"URL.所以我尝试在这里实现与描述情况类似的东西:
我已经使用contextRelative ="true"设置RedirectStrategy bean并从LoginSuccessHandler扩展类中的AbstractAuthenticationTargetUrlRequestHandler覆盖redirectStrategy setter,我看到HttpServletResponse对象的redirectStrategy属性按预期设置为true.仍然没有解决问题.
此外,当使用encodeRedirectURL("otherLogin")更改HttpServletResponse对象的redirectURLCC属性时,设置类似于
”http://192.168.0.10:8090/otherLogin”
而这不是我需要的.我需要删除URL的整个协议+ ipaddress部分.响应对象的URL属性无法进行更改,因为它由Filter和FilterChain接口实现包装.
请提出任何想法.我想这种事情应该在web.xml或auth-AplicationContext.xml文件中解决,而不是在代码中.
最好的祝福.
我在项目中使用 Grails (2.2.2),并且我的应用程序发出不需要的 http 重定向而不是 https 重定向。
目前,我们在 Oracle Weblogic 前面有一个 F5 负载均衡器。F5 正在从 Weblogic 卸载我们的 SSL。F5仅接受https请求,Weblogic仅接受http请求。
我的 Grails 项目使用 Spring Security 和 Spring Security CAS 插件。
该问题通常发生在成功登录 CAS 时。Grails 似乎总是发出 HTTP 重定向。
我的 serverURL 指定 HTTPS,就像我的所有 CAS 配置变量一样。喜欢
grails.serverURL = "https://example.com/${appName}"
Run Code Online (Sandbox Code Playgroud)
有没有办法强制 GRAILS/Weblogic 仅发出 https 重定向?
编辑 #1 - 更多信息
我尝试这样做但没有运气:
grails.plugin.springsecurity.secureChannel.useHeaderCheckChannelSecurity = true
grails.plugin.springsecurity.secureChannel.definition = [
'/**': 'REQUIRES_SECURE_CHANNEL'
]
grails.plugin.springsecurity.portMapper.httpPort = 80
grails.plugin.springsecurity.portMapper.httpsPort = 443
grails.plugin.springsecurity.secureChannel.secureHeaderName = 'WL-Proxy-SSL'
grails.plugin.springsecurity.secureChannel.secureHeaderValue = 'http'
grails.plugin.springsecurity.secureChannel.insecureHeaderName = 'WL-Proxy-SSL'
grails.plugin.springsecurity.secureChannel.insecureHeaderValue = 'https'
Run Code Online (Sandbox Code Playgroud)
另外,该行为似乎可能与 …