Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8416019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:37:12+00:00 2026-06-10T01:37:12+00:00

Assume I have two methods @Secured(ROLE_ADMIN) @RequestMapping(value = /methodA, method = RequestMethod.GET) public void

  • 0

Assume I have two methods

 @Secured("ROLE_ADMIN")
 @RequestMapping(value = "/methodA", method = RequestMethod.GET)
 public void MethodA(){
 // code
 }

and another method which calls the first method

@RequestMapping(value = "/MethodB", method = RequestMethod.GET)
public void MethodB(){
MethodA();
//code
}

If I login to the application with an authority ROLE_USER and tries accessing the URL /methodA I get an access denied exception – perfect! but if i access URL /methodB I don’t get an access denied exception even though i am accessing MethodA there with a ROLE_USERauthority. Is it supposed to work like that or am i doing something wrong.

PS: This isn’t a real time application scenario, but I was just playing around with the code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:37:14+00:00Added an answer on June 10, 2026 at 1:37 am

    This is because spring security works by proxying your secured classes. This means that it puts a wrapper around your existing class. This can either be a java.lang.Proxy if using an interface based proxy, or it can be a cglib enhanced subclass. I don’t want to go too heavily into that here though.

    But the bottom line is that when an External caller calls one of your methods this is what happens:

    Caller —> Proxy —> Security Interceptor —> Implementation class

    It’s the Security interceptor that inspects the annotations and determines what security to apply. However, once you’re in the actual implementation class, you’re just calling methods without the proxy and security interceptor being involved, and thus no security checks.

    As such, you need to protect your each entry point with the @Secured annotation that’s appropriate for it, and whatever it calls internally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

assume that i have two sequential methods, methodA and methodB ( methodB is called
I have a program with two methods. The first method takes two arrays as
Let's assume I have two service classes with the following methods: GroupService createGroup() deleteGroup()
Assume I have two tables, Student Test Id Name TestId Type StudentId -- ----
Assume I have two tables: Table MY_ENTITY ID: PK OTHER_ID: FK to table OTHER
Lets assume I have two hashes. One of them contains a set of data
Let's assume we have two arrays of the same size - A and B
Let's assume I have two gmdistibution models that i obtained using modeldata1=gmdistribution.fit(data1,1); modeldata2=gmdistribution.fit(data2,1); Now
Assume that we have two sets: A=(a_1,a_2,...,a_m) and B=(b_1,b_2,...,a_n) (Not necessarily of same size).
Assume that I have two arrays as follow: $array1 = array(1, 3, 5); $array2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.