Grails 3和Spring Security Plugin [英] Grails 3 and Spring Security Plugin

查看:96
本文介绍了Grails 3和Spring Security Plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用Grails,我想测试Spring Security Plugin。我使用的是Grails v3.0.0RC2,我发现很难找到准确的文档。



我在看Spring Security Plugin的Grails页面位于 http://grails.org/plugin/spring-安全核心,并且它告诉我将以下内容添加到grails-app / conf / BuildConfig中

pre $ plugins {
...
compile':spring-security-core:2.0-RC4'
...
}

现在,Grails 3已经取消了BuildConfig,转而使用Gradle。所以我想我可以将这个编译行写入build.gradle中的依赖关系部分,它可以工作,就像这样:

 依赖关系{
...
compile::spring-security-core:2.0-RC4
}

然而,这并不奏效。我收到错误无法找到:spring-security-core:2.0-RC4 ...。

然后我想,'嘿,这是一个插件,让我尝试使用org.grails.plugins作为它的前缀,就像我在build.gradle文件中的其他地方看到的一样:

  dependencies {
...
编译:org.grails.plugins:spring-security-core:2.0-RC4
}

仍然没有去。



我已经通过添加search.maven.org上的依赖项来编译它,如下所示:

 依赖关系{
...
compile'org.springframework.security:spring-security-core:4.0.0.RELEASE'
}

但我不认为这是正确的方法,因为Grails文档说我应该可以访问命令

  grails s2-quickstart 

一旦安装了插件,我不会在使用Maven repo的时候这样做。



我确定有一个简单的配置我正在做的错误,因为我对Grails,Spring和Gradle都很陌生,所以我非常感谢任何可以提供的帮助。 解决方案 Spring Security Starter for Spring Boot 。



这是 spring $ 20security / grails-dev-discuss / jOF0jw_BiCs / tOxd0NZpaxkJrel =nofollow noreferrer>>讨论,并且许多Grails插件将不会移动到Grails 3,而是将被替换通过纯粹的Spring解决方案。



更新 b

一直是为Grails 3.x创建的Spring Security插件。它可以在这里找到: https://bintray.com/grails/plugins/ spring-security-core / view


I've just recently started working with Grails, and I'd like to test out the Spring Security Plugin. I'm using Grails v3.0.0RC2, and I'm finding it difficult to come across accurate documentation for it with a lot of things.

I'm looking at the Grails page for the Spring Security Plugin, located at http://grails.org/plugin/spring-security-core, and it tells me to add the following to grails-app/conf/BuildConfig

plugins {
  …
  compile ':spring-security-core:2.0-RC4'
  …
}

Now, Grails 3 has done away with the BuildConfig, and moved over to using Gradle. So I figured I could just that compile line to my "dependencies" section in build.gradle and it would work, like so:

dependencies{
  ...
  compile:":spring-security-core:2.0-RC4"
}

However, that did not work. I get the error "Could not find :spring-security-core:2.0-RC4...".

Then I figured, 'Hey, it's a plugin, let me try prefacing it with "org.grails.plugins" like I see elsewhere in the build.gradle file:

dependencies{
  ...
  compile:"org.grails.plugins:spring-security-core:2.0-RC4"
}

And still no go.

I have gotten it to compile by adding the dependency found on search.maven.org, like so:

dependencies{
  ...
  compile 'org.springframework.security:spring-security-core:4.0.0.RELEASE'
}

But I don't think thats the proper way to do, because Grails documentation says I should have access to the command

grails s2-quickstart

once the plugin is installed, which I do not when I do it using the Maven repo.

I'm sure there's a simple configuration error I'm making, as I'm very new to both Grails, Spring, and Gradle, so I appreciate any help that can be provided.

解决方案

The Spring Secuirty core plugin for Grails is not Grails 3 compatible. However, since Grails 3 is based on Spring Boot you can use the Spring Security Starter for Spring Boot instead.

This has been discussed on the Grails developers mailing list and going forward many Grails plugins will not be moved to Grails 3 and instead will be replaced by pure Spring solutions.

Update

Since this question was originally asked there has been a Spring Security plugin created for Grails 3.x. It can be found here: https://bintray.com/grails/plugins/spring-security-core/view

这篇关于Grails 3和Spring Security Plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆