我已将 spring-security-facebook 安装到测试 grail 应用程序中。这是在安装 spring-security-core 并运行 s2-quickstart 后完成的。
我只是一个新手,正在尝试将 Facebook 登录按钮集成到我的测试应用程序中。但是,问题是,当我运行 s2-init-facebook 时,该插件没有生成默认的 Dao,正如 http://grails.org/plugin/spring-security-facebook 中的文档所述。
Use your own authentication dao
Plugin generates an Dao, after calling s2-init-facebook@, and put it into your @conf/spring/resources.groovy and @Config.groovy@. Actually it's an 'dumb' dao implementations, you have to rewrite it to follow your data structures:
我的应用程序目录的缩短树输出如下:
.
├── application.properties
├── grails-app
│ ├── conf
│ │ ├── ApplicationResources.groovy
│ │ ├── BootStrap.groovy
│ │ ├── BuildConfig.groovy
│ │ ├── Config.groovy
│ │ ├── DataSource.groovy
│ │ ├── hibernate
│ │ ├── spring
│ │ │ └── resources.groovy
│ │ └── UrlMappings.groovy
│ ├── controllers
│ │ ├── LoginController.groovy
│ │ └── LogoutController.groovy
│ ├── domain
│ │ └── com
│ │ └── fbtest
│ │ └── webapp
│ │ └── auth
│ │ ├── FacebookUser.groovy
│ │ ├── SecRole.groovy
│ │ ├── SecUser.groovy
│ │ └── SecUserSecRole.groovy
│ ├── i18n
│ │ ├── ...
│ ├── services
│ ├── taglib
│ ├── utils
│ └── views
│ ├── error.gsp
│ ├── index.gsp
│ ├── layouts
│ │ └── main.gsp
│ └── login
│ ├── auth.gsp
│ └── denied.gsp
├── lib
├── scripts
├── src
│ ├── groovy
│ └── java
├── test
│ ├── integration
│ └── unit
└── web-app
├── ...
resource.groovy 文件也是空的。
// Place your Spring DSL code here
beans = {
}
请帮助我理解我是否做错了什么。
我使用的 Grails 版本:2.0.4,spring-security-facebook 的版本是 0.8。
提前致谢。
最佳答案
哦,它应该从文档中删除。对于最新版本,没有必要有自己的 DAO,现在它有默认的非常灵活的 dao。现在它不是在安装过程中生成的。尝试运行您的应用程序,如果一切配置正确,它应该可以工作。
如果您自己实现了 DAO,您仍然可以使用它。但对于 0.7 以来的版本,几乎所有内容都可以使用可选的 FacebookAuthService
进行扩展,如果您愿意,您可以实现它(文档中也有描述)。
关于facebook - spring-security-facebook、s2-init-facebook 未生成默认 Dao,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10992235/