简体   繁体   English

使用自定义Grails Spring Security过滤器时登录失败

[英]Login failed when using custom Grails Spring Security filter

I am using Grails with the Spring Security plugin. 我将Grails与Spring Security插件一起使用。

I have crafted a custom filter, authentication provider, and token and registered them as beans and into filter chain: 我精心制作了一个自定义过滤器,身份验证提供程序和令牌,并将它们注册为bean并进入过滤器链:

SpringSecurityUtils.clientRegisterFilter('myFilter',SecurityFilterPosition.SECURITY_CONTEXT_FILTER.order + 10) 

(I am not really sure what the order should be) (我不太确定订单应该是什么)

I POST to j_spring_security_check . 我发布到j_spring_security_check

All seems to run smoothly to my successfulAuthentication where I set: 一切似乎都顺利进行到我设置的成功身份验证:

SecurityContextHolder.getContext().setAuthentication(authResult);

with no errors and SecurityContextHolder.getContext().getAuthentication() is set. 没有错误,并且设置了SecurityContextHolder.getContext().getAuthentication()

However Grails redirects me to login failed page. 但是Grails将我重定向到登录失败的页面。

Is something wrong with the j_spring_security_check page? j_spring_security_check页面有问题吗? Where is the error? 错误在哪里?

It was the url j_spring_security_check - it somehow rewrote the security context. 这是URL j_spring_security_check-它以某种方式重写了安全性上下文。 So on using custom filters DO NOT use post url "j_spring_security_check", not necessary also. 因此,在使用自定义过滤器时, 请勿使用发布网址“ j_spring_security_check”,这也是不必要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM