【问题标题】:Grails spring security alternative for deprecated SPRING_SECURITY_LAST_USERNAME_KEY已弃用的 SPRING_SECURITY_LAST_USERNAME_KEY 的 Grails spring 安全替代方案
【发布时间】:2015-04-11 19:05:45
【问题描述】:

我正在开发一个 grails 应用程序,我需要在其中摆弄 Session 变量以实现自定义 Spring Security 身份验证,并且需要设置以下内容-

request.session[SPRING_SECURITY_LAST_USERNAME_KEY] =
            TextEscapeUtils.escapeEntities(username)

现在这个密钥来自org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY 现在已弃用。你能推荐我一个替代方案吗?

【问题讨论】:

    标签: spring grails spring-security


    【解决方案1】:

    是的,我也遇到过同样的问题。它有一个非常简单的替代方案-

    import grails.plugin.springsecurity.SpringSecurityUtils;
    

    现在使用SpringSecurityUtils.SPRING_SECURITY_LAST_USERNAME_KEY 这将起作用并且不会被弃用。

    【讨论】:

      猜你喜欢
      • 2019-11-29
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 2016-01-08
      • 2020-11-07
      • 2020-05-22
      • 2022-11-09
      • 2020-01-19
      相关资源
      最近更新 更多