Grails remote control plugin - Spring Security Configuration

给你一囗甜甜゛ 提交于 2019-12-12 06:24:42

问题


Whenever I try to use the Grails Remote Control plugin, I get the following Exception.

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)

A simple Google search reveals that it is most likely due to a conflict with the Spring Security plugin. You can see it here. Unfortunately, I cannot find any information on how to properly configure it without going deep into the Spring Security plugin documentation.

How do I configure the spring security core to permitAll for the grails-remote-control url?


回答1:


Put Below code in your config.groovy

grails.plugin.springsecurity.securityConfigType = 'InterceptUrlMap'

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



回答2:


If you are using spring security 2 with staticRules + controllerAnnotations, it also works:

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


来源:https://stackoverflow.com/questions/30758016/grails-remote-control-plugin-spring-security-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!