【问题标题】:OAuth 2.0 for Grails without Spring security没有 Spring 安全性的 Grails 的 OAuth 2.0
【发布时间】:2014-05-26 03:06:24
【问题描述】:

我目前正在为 Google SignIn 实施 Shiro-Authentication 和 OAuth。这一切都很好,让我可以根据数据库中的用户电子邮件验证 gmail 帐户。 我的构建配置如下所示:

    //User roles and permissions
    compile (":shiro:1.2.0") {
        excludes "servlet-api"
        excludes "shiro-quartz"
    }

    //Google SignIn
    compile ":oauth:2.1.0" 

我遇到的唯一问题是,当谷歌为我的应用程序请求许可时,我得到了这个:

当我期待更像这样的东西时:

它显然仍在使用 OAuth 1.0 而不是 2.0。 我在这里阅读了很多问题,我找到的最接近的是Google consent screen not shown as expected

这个实现的唯一问题是它使用了 Spring 安全性,而我使用的是 Shiro。当我尝试使用 spring 插件时,我在尝试编译它时不断遇到这个问题:

| Error The following artifacts could not be resolved: org.springframework.security:spring-security-core:jar:3.2.0.RC1, org.springframework.security:spring-security-web:jar:3.2.0.RC1: Could not find artifact org.springframework.security:spring-security-core:jar:3.2.0.RC1 in grailsCentral (http://repo.grails.org/grails/plugins)
| Run 'grails dependency-report' for further information.

IDEA hook: Grails not found!
| Error java.lang.NullPointerException
| Error     at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:135)
| Error     at java.lang.Thread.run(Thread.java:695)

非常感谢任何提示或建议。

干杯。

【问题讨论】:

  • 我目前正在重新审视这个问题。任何人有任何想法或类似问题的链接?

标签: grails oauth spring-security google-authentication grails-2.3


【解决方案1】:

我创建了一个sample grails application,它使用oauth plugingoogle authenticationoauth2

试一试。

我按照here 的建议在src/java 中创建了一个新的java 文件,并在Config.groovy 的我的google 配置中使用它。

我已经提供了完整的解决方案here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-18
    • 2020-07-01
    • 2020-08-17
    • 2015-03-05
    • 2014-12-09
    • 2015-12-29
    • 2013-06-14
    • 1970-01-01
    相关资源
    最近更新 更多