Skip to content

Sudarshan-Gowda/SpringMvc-SecuredAnnotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SpringMvc-SecuredAnnotation

Method Security with @Secured Annotations based on User Role

Steps to run the application:

  1. Download or Clone this Project and do maven import.
git clone https://github.com/Sudarshan-Gowda/SpringMvc-SecuredAnnotation.git
  1. Use the below command to run the application locally. Before that make sure you have maven plugin installed in your machine. mvn tomcat7:run-war

  2. Once the application launched up successfully, Use the below credentails to login into system. Currenlty two users are maintained in the system and each one having different role.

    1. Username - user, password - password, role - ROLE_USER
    2. Username - admin, password - password, role - ROLE_ADMIN
  3. Here the method is secured with @Secured annotation based on the roles of the user, So each user will be having different access rights to the specific url or the screen.

  4. Find the below code snippet for the configuration and usage of @Secured annotation in method level,

       @Secured("ROLE_USER")
       int placeOrder(TechnologyDetails order);
    
       @Secured("ROLE_ADMIN")
       List<TechnologyDetails> getOrderList();
    
  5. You can also configure the multiple role access to same function as below,

    @Secured({"ROLE_USER","ROLE_ADMIN"})
    

About

Method Security with Secured Annotations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages