Meaningless Drivel is fun!*
The moose likes Spring and the fly likes why we should use  method security in spring security? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "why we should use  method security in spring security?" Watch "why we should use  method security in spring security?" New topic
Author

why we should use method security in spring security?

sina poores
Greenhorn

Joined: Jul 07, 2011
Posts: 20
i am new to spring security and i have a question.
why request security is not suffcient for mvc web application and we should use method (pre-post) annotation for security in methods.in other word why we need method security in web application that the only chanel between application and client are request(and response).
thanks alot
Rohit Mehta
Ranch Hand

Joined: Mar 11, 2005
Posts: 79

What I feel is that request security provide Authentication (whether you are a valid person to log on / use to system) - where as method level security is a tool which is used to identify whether an user has sufficient privileges (i.e. authorization) to call particular method or not.

It is useful where we have multiple roles & provide functionality restricted as per roles. Authorization is a basic requirement for large apps.

Most of the Enterprise level apps implement authorization in one way or other. Spring has also come up with their way.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Rohit Mehta wrote:What I feel is that request security provide Authentication (whether you are a valid person to log on / use to system) - where as method level security is a tool which is used to identify whether an user has sufficient privileges (i.e. authorization) to call particular method or not.

It is useful where we have multiple roles & provide functionality restricted as per roles. Authorization is a basic requirement for large apps.

Most of the Enterprise level apps implement authorization in one way or other. Spring has also come up with their way.


In Spring Security it isn't like that.

You have authorization and authentication on both levels.

The reason why you add method security with request security is to protect yourself from a hacker skipping over your URL request and hitting the middle tier server and method of you class directly.

Rohit Mehta
Ranch Hand

Joined: Mar 11, 2005
Posts: 79

Thanks for clarification Mark!
 
Don't get me started about those stupid light bulbs.
 
subject: why we should use method security in spring security?