【问题标题】:Grails remote control plugin - Spring Security ConfigurationGrails 远程控制插件 - Spring Security 配置
【发布时间】:2015-08-25 19:18:09
【问题描述】:

每当我尝试使用 Grails 远程控制插件时,都会收到以下异常。

groovyx.remote.RemoteControlException: Error sending command chain to 'http://localhost:8080/******/grails-remote-control'
    [test] at groovyx.remote.transport.http.HttpTransport.send(HttpTransport.groovy:65)
    [test] at groovyx.remote.client.RemoteControl.sendCommandChain(RemoteControl.groovy:114)
    [test] at groovyx.remote.client.RemoteControl.exec(RemoteControl.groovy:73)
    [test] at groovyx.remote.client.RemoteControl.exec(RemoteControl.groovy:67)
    [test] at cgw.login.AbstractCGWGebSpec.msg(AbstractCGWGebSpec.groovy:35)
    [test] at cgw.login.AbstractCGWGebSpec.Login to cgw application(AbstractCGWGebSpec.groovy:25)
[test] Caused by: java.io.StreamCorruptedException: invalid stream header: 3C68746D
    [test] at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:782)
    [test] at java.io.ObjectInputStream.(ObjectInputStream.java:279)
    [test] at groovyx.remote.util.ClassLoaderConfigurableObjectInputStream.(ClassLoaderConfigurableObjectInputStream.groovy:26)
    [test] at groovyx.remote.Result.readFrom(Result.groovy:150)
    [test] at groovyx.remote.transport.http.HttpTransport.send_closure1(HttpTransport.groovy:62)
    [test] at groovyx.remote.transport.http.HttpTransport.send(HttpTransport.groovy:53)

一个简单的谷歌搜索表明它很可能是由于与 Spring Security 插件冲突。你可以看到它here。不幸的是,如果不深入了解 Spring Security 插件文档,我找不到任何有关如何正确配置它的信息。

如何为 grails-remote-control url 配置 spring 安全核心来允许所有?

【问题讨论】:

  • 它对你有用吗?
  • 成功了。谢谢阿南特

标签: grails spring-security geb remote-control


【解决方案1】:

将下面的代码放在你的 config.groovy 中

grails.plugin.springsecurity.securityConfigType = 'InterceptUrlMap'

grails.plugin.springsecurity.interceptUrlMap = [
        '/grails-remote-control/**':       ['IS_AUTHENTICATED_ANONYMOUSLY']
]

【讨论】:

    【解决方案2】:

    如果您使用带有 staticRules + controllerAnnotations 的 spring security 2,它也可以工作:

    grails.plugin.springsecurity.controllerAnnotations.staticRules = [
            '/grails-remote-control/**': ["permitAll"]
    ]
    

    【讨论】:

      猜你喜欢
      • 2014-04-01
      • 2018-02-16
      • 2012-04-19
      • 2012-12-28
      • 2016-05-24
      • 2015-06-18
      • 2016-04-13
      • 2011-08-15
      • 2016-03-23
      相关资源
      最近更新 更多