Grails 3 and spring-boot-starter-security

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails 3 and spring-boot-starter-security

Rafael Felini
Hi guys,

    I am trying to configure Spring Security via spring-boot-starter-security on Grails 3 and everything is going fine until I tried to enable @Secured annotations with @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.

    After annotations are enabled this error come up:
Exception in thread "main" java.lang.IllegalArgumentException: Class name [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator] is not a known auto-proxy creator class
        at org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
        at org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
        at org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
 
    Anyone has an idea of what it might be?

   I'm using Grails 3 RC 2 and Java 8.

Thanks,
Rafael

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/bda9a5c0-4642-47c0-8b36-f65e9f2f7708%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

Osaetin Evbuoma
Where you able to get a solution to this problem?

On Thursday, 19 March 2015 13:32:47 UTC+1, Rafael Felini wrote:
Hi guys,

    I am trying to configure Spring Security via spring-boot-starter-security on Grails 3 and everything is going fine until I tried to enable @Secured annotations with @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.

    After annotations are enabled this error come up:
Exception in thread "main" java.lang.IllegalArgumentException: Class name [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator] is not a known auto-proxy creator class
        at org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
        at org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
        at org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
 
    Anyone has an idea of what it might be?

   I'm using Grails 3 RC 2 and Java 8.

Thanks,
Rafael

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

Rafael Felini
No, we ended up implementing an url based solution.


On Wed, May 6, 2015 at 7:11 AM Osaetin Evbuoma <[hidden email]> wrote:
Where you able to get a solution to this problem?


On Thursday, 19 March 2015 13:32:47 UTC+1, Rafael Felini wrote:
Hi guys,

    I am trying to configure Spring Security via spring-boot-starter-security on Grails 3 and everything is going fine until I tried to enable @Secured annotations with @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.

    After annotations are enabled this error come up:
Exception in thread "main" java.lang.IllegalArgumentException: Class name [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator] is not a known auto-proxy creator class
        at org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
        at org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
        at org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
 
    Anyone has an idea of what it might be?

   I'm using Grails 3 RC 2 and Java 8.

Thanks,
Rafael

--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/hr1skz1RaZo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAM5%3D1LTy%2B6yXSFW7M3iK3bfFuC3SBeHoU91vqDRTHEAH26jv9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

bobbywarner
The JSR 250 @RolesAllowed annotations have been working great for me.  Here's an example:

https://github.com/bobbywarner/grails3-oauth2-api/blob/master/grails-app/init/demo/OAuth2ServerConfiguration.groovy#L31

https://github.com/bobbywarner/grails3-oauth2-api/blob/master/grails-app/controllers/demo/ProfileController.groovy#L7


Hope that helps!
Bobby

On Tuesday, May 19, 2015 at 12:19:06 PM UTC-5, Rafael Felini wrote:
No, we ended up implementing an url based solution.


On Wed, May 6, 2015 at 7:11 AM Osaetin Evbuoma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="LftjSq3zCx4J" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osaetin...@...> wrote:
Where you able to get a solution to this problem?


On Thursday, 19 March 2015 13:32:47 UTC+1, Rafael Felini wrote:
Hi guys,

    I am trying to configure Spring Security via spring-boot-starter-security on Grails 3 and everything is going fine until I tried to enable @Secured annotations with @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.

    After annotations are enabled this error come up:
Exception in thread "main" java.lang.IllegalArgumentException: Class name [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator] is not a known auto-proxy creator class
        at org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
        at org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
        at org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
 
    Anyone has an idea of what it might be?

   I'm using Grails 3 RC 2 and Java 8.

Thanks,
Rafael

--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/grails-dev-discuss/hr1skz1RaZo/unsubscribe" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/topic/grails-dev-discuss/hr1skz1RaZo/unsubscribe';return true;" onclick="this.href='https://groups.google.com/d/topic/grails-dev-discuss/hr1skz1RaZo/unsubscribe';return true;">https://groups.google.com/d/topic/grails-dev-discuss/hr1skz1RaZo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="LftjSq3zCx4J" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="LftjSq3zCx4J" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/0b00c38b-6390-4219-9b74-b26a6e36baac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

Volnei Munhoz
In reply to this post by Rafael Felini
Works fine for me too.



Em quinta-feira, 19 de março de 2015 09:32:47 UTC-3, Rafael Felini escreveu:
Hi guys,

    I am trying to configure Spring Security via spring-boot-starter-security on Grails 3 and everything is going fine until I tried to enable @Secured annotations with @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.

    After annotations are enabled this error come up:
Exception in thread "main" java.lang.IllegalArgumentException: Class name [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator] is not a known auto-proxy creator class
        at org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
        at org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
        at org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
 
    Anyone has an idea of what it might be?

   I'm using Grails 3 RC 2 and Java 8.

Thanks,
Rafael

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/05d46b84-8761-4ef5-a855-3b2759700b73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Volnei Munhoz
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

Arndt Teinert
In reply to this post by Rafael Felini
Solved this by adding:


class
Application extends GrailsAutoConfiguration {
static void main(String[] args) {

Field field = AopConfigUtils.getDeclaredField("APC_PRIORITY_LIST")
field.setAccessible(true)
Object obj = field.get(null)
List<Class<?>> list = (List<Class<?>>) obj
list.add(GroovyAwareAspectJAwareAdvisorAutoProxyCreator.class)

GrailsApp.run(Application)
}

}

to the Grails Application class and by subclassing the @Secured enabling class:

/**
* To enable @Secured method security
*/
@EnableGlobalMethodSecurity(securedEnabled = true)
class MethodSecurityConfiguration extends GlobalMethodSecurityConfiguration {

Logger log = LoggerFactory.getLogger(MethodSecurityConfiguration.class)

MethodSecurityConfiguration() {
log.debug("MethodSecurityConfiguration initialized")
}
}


I know this is somehow a dirty trick and will fail if a security manager prevents access to the private static field.
I don't know which side effects this will cause.
May be there is a better way to "register" GroovyAwareAspectJAwareAdvisorAutoProxyCreator within the AopConfigUtils class.

It works for me.

Cheers


Am Donnerstag, 19. März 2015 13:32:47 UTC+1 schrieb Rafael Felini:
Hi guys,

    I am trying to configure Spring Security via spring-boot-starter-security on Grails 3 and everything is going fine until I tried to enable @Secured annotations with @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.

    After annotations are enabled this error come up:
Exception in thread "main" java.lang.IllegalArgumentException: Class name [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator] is not a known auto-proxy creator class
        at org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
        at org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
        at org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
 
    Anyone has an idea of what it might be?

   I'm using Grails 3 RC 2 and Java 8.

Thanks,
Rafael

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/f4b09790-7bcc-45af-808d-f1be4e6e53e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

Arndt Teinert

changed it to:


class Application extends GrailsAutoConfiguration {

Closure doWithSpring() {{->
System.out.println("INFO: Extending APC_PRIORITY_LIST with GroovyAwareAspectJAwareAdvisorAutoProxyCreator")
// this is a work-around to get @Secured method security up and running
// looks like the GroovyAwareAspectJAwareAdvisorAutoProxyCreator is missing in AopConfigUtils
Field field = AopConfigUtils.getDeclaredField("APC_PRIORITY_LIST")
field.setAccessible(true)
List<Class<?>> list = (List<Class<?>>) field.get(null)
list.add(GroovyAwareAspectJAwareAdvisorAutoProxyCreator.class)
}}

static void main(String[] args) {
GrailsApp.run(Application)
}

}

to let this work in a servlet container.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/c311b9ca-36f6-488d-aef7-6a547b2d6eb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 3 and spring-boot-starter-security

Arvind Das
This post has NOT been accepted by the mailing list yet.
This post was updated on .
In reply to this post by bobbywarner
But It does not redirect to login page automatically ? Any Ideas?

Though, setting up url level security helps to the most but I am more interested in annotated security. Will look for it , with a fix will reply to this post
bobbywarner wrote
The JSR 250 @RolesAllowed annotations have been working great for me.
 Here's an example:

https://github.com/bobbywarner/grails3-oauth2-api/blob/master/grails-app/init/demo/OAuth2ServerConfiguration.groovy#L31

https://github.com/bobbywarner/grails3-oauth2-api/blob/master/grails-app/controllers/demo/ProfileController.groovy#L7


Hope that helps!
Bobby

On Tuesday, May 19, 2015 at 12:19:06 PM UTC-5, Rafael Felini wrote:
>
> No, we ended up implementing an url based solution.
>
>
> On Wed, May 6, 2015 at 7:11 AM Osaetin Evbuoma <[hidden email] 
> <javascript:>> wrote:
>
>> Where you able to get a solution to this problem?
>>
>>
>> On Thursday, 19 March 2015 13:32:47 UTC+1, Rafael Felini wrote:
>>>
>>> Hi guys,
>>>
>>>     I am trying to configure Spring Security via
>>> spring-boot-starter-security on Grails 3 and everything is going fine until
>>> I tried to enable @Secured annotations with
>>> @EnableGlobalMethodSecurity(securedEnabled = true) in my config class.
>>>
>>>     After annotations are enabled this error come up:
>>> Exception in thread "main" java.lang.IllegalArgumentException: Class
>>> name
>>> [org.grails.spring.aop.autoproxy.GroovyAwareAspectJAwareAdvisorAutoProxyCreator]
>>> is not a known auto-proxy creator class
>>>         at
>>> org.springframework.aop.config.AopConfigUtils.findPriorityForClass(AopConfigUtils.java:140)
>>>         at
>>> org.springframework.aop.config.AopConfigUtils.registerOrEscalateApcAsRequired(AopConfigUtils.java:113)
>>>         at
>>> org.springframework.aop.config.AopConfigUtils.registerAutoProxyCreatorIfNecessary(AopConfigUtils.java:74)
>>>  
>>>     Anyone has an idea of what it might be?
>>>
>>>    I'm using Grails 3 RC 2 and Java 8.
>>>
>>> Thanks,
>>> Rafael
>>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Grails Dev Discuss" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/grails-dev-discuss/hr1skz1RaZo/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [hidden email] <javascript:>.
>> To post to this group, send email to [hidden email] 
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com 
>> <https://groups.google.com/d/msgid/grails-dev-discuss/40ce40fb-c59f-4b99-adf3-6b4ab9bf1416%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/0b00c38b-6390-4219-9b74-b26a6e36baac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.