Results 1 to 2 of 2

Thread: @Secured({ "ROLE_ADMIN" }) is been ignored

Threaded View

  1. #1
    Join Date
    Mar 2011
    Posts
    1

    Default @Secured({ "ROLE_ADMIN" }) is been ignored

    Hi,
    I have a javaconfig file that is working fine.
    i debug my application in loading time and i see that the parameter is been transfered.
    Code:
    @Configuration
    public class SpringJavaConfig {	
    	@Bean
    	public BrandsApi brandsApi(){
    		return new BrandsApi();
    	}
    }
    inside BrandsApi I have a method with @Secured({ "ROLE_ADMIN" }) above it

    this is how i call the method:
    Code:
    ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringJavaConfig.class);
    	BrandsApi brandsApi = (BrandsApi)ctx.getBean(BrandsApi.class);
            brandsApi.getAll();
    but for some reason i can get inside even though I have logged in ROLE_EMPLOYEE

    this is my BrandsApi class:
    Code:
    class BrandsApi extends BaseApi{
    	@Secured({ "ROLE_ADMIN" })
    	public void getAll() {
    		System.out.println("Hello");
    	}
    }
    Attached my xml's config.

    Thanks!
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •