I have been able to implement the @Secured annotation in one controller of my application. Yet, @Secured(‘ROLE_ADMIN’) will NOT work anywhere else within the project.
It will only specifically work anywhere within my program controller and no where else.
For example, if I use it as so;
@Secured('ROLE_ADMIN')
The IDE gives me;
Multiple markers at this line
– Groovy:class Secured is not an annotation in @Secured
– Groovy:unable to resolve class Secured , unable to find class for
I have even tried checking the Spring Security Config file to check if annotations were set correctly (which seemingly they were).
Any ideas? Please help.
Thanks.
You are probably missing the required import.
At the top of each controller where you need the annotations use the grails import for Secured. Then you can use the annotations for the class or method as needed.
Hope this helps.