【问题标题】:Using simple auth and form based access to controllers使用简单的身份验证和基于表单的控制器访问
【发布时间】:2014-12-25 09:54:51
【问题描述】:

假设我有一个 Grails 2.4.3 应用程序,只有一个控制器:

@Secured(['ROLE_USER'])
Class HeyController {
    def doSomething() { render "Do something" }
    def doSomethingElse() { render "Do something else" }
}

我想告诉底层 Spring Security 框架像这样保护访问:

  • http://myhost:8080/app/hey/doSomething 的基于表单的登录
  • http://myhost:8080/app/hey/doSomethingElse 的基本 HTTP 身份验证

我知道可以使用 vanilla Spring 安全性配置此访问权限,在安全上下文配置文件中为每个访问模式使用两个 <http> 配置部分。

因此,一定有一些方法可以通过 Grails 设置 Spring Security 对吧?谢谢!

【问题讨论】:

    标签: spring authentication grails spring-security


    【解决方案1】:

    ...没关系facepalm。好像是这样:

    http://grails-plugins.github.io/grails-spring-security-core/guide/authentication.html

    我会在将答案付诸实践后立即对其进行标记。谢谢!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-08
      • 2014-12-13
      • 2011-10-24
      • 2015-02-06
      • 1970-01-01
      • 2016-05-07
      • 1970-01-01
      相关资源
      最近更新 更多