File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Unsecured method in @Secured annotated class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Unsecured method in @Secured annotated class." Watch "Unsecured method in @Secured annotated class." New topic

Unsecured method in @Secured annotated class.

Bogdan Baraila
Ranch Hand

Joined: May 23, 2011
Posts: 43
Hello to all,

Is there away to unsecure just a single method from a spring service that is annotated with the @Secured annotation. I know that I could annotate just the method I want and leave the unsecured one without an annotation, but since all except one are secured methods i would prefer to leave the annotation at class level.

Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

Nope you cant put it at the class level unless you want all the methods secured. However, method level annotations override the class one, so say if you have an Anonymous role, you could override the class level annotation by adding an @Secured("ROLE_ANNONYMOUS") on just that method.

[How To Ask Questions][Read before you PM me]
Bogdan Baraila
Ranch Hand

Joined: May 23, 2011
Posts: 43
Thanks Bill. Indeed the ROLE_ANNONYMOUS should work, but unfortunately i'm using Spring security with flex and i wasn't able to set up the anonymous filtering.
Kannan Mugundan

Joined: Oct 25, 2012
Posts: 1
Did you solve the problem, I am using Spring BlazeDS Integration. I wanted to unsecure a single method (Change password in case of password expiry, I want user to change password, before allowing a successful login.)
I also added @Secured ({ROLE_ANNONYMOUS}),
I also have Flex channels secured in

Any help on how to do this is appreciated.
I agree. Here's the link:
subject: Unsecured method in @Secured annotated class.
It's not a secret anymore!