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

  • Home
  • SEARCH
  • 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 6638715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:28:06+00:00 2026-05-25T23:28:06+00:00

I have the following Spring security configuration: <security:http> <security:intercept-url pattern=/** access=ROLE_USER/> <security:intercept-url pattern=/auth/** access=ROLE_ADMIN/>

  • 0

I have the following Spring security configuration:

<security:http>
     <security:intercept-url pattern="/**"  access="ROLE_USER"/>
     <security:intercept-url pattern="/auth/**"  access="ROLE_ADMIN"/>
....
</security:http> 

I would like to revoke “ROLE_ADMIN” authority from the user when he navigates out of “/auth/**” zone.

How can I achieve such functionality? Can I put some kind of filter on all URLs except /auth/** which revokes Authority from the user?

Can I revoke it “on the fly”?

  • 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-05-25T23:28:07+00:00Added an answer on May 25, 2026 at 11:28 pm

    I would like to revoke "ROLE_ADMIN" authority from the user when he navigates out of "/auth/**" zone.

    How can I achieve such functionality? Can I put some kind of filter on all URLs except /auth/** which revokes Authority from the user?

    Can I revoke it "on the fly"?

    I think you are misunderstanding the meaning of the intercept-url element:

    <security:intercept-url pattern="/auth/**"  access="ROLE_ADMIN"/>
    

    This does NOT say "grant the user ROLE_ADMIN in the /auth/** tree". It says, "a user who has ROLE_ADMIN is allowed to access pages in the /auth/** tree".

    The idea that a user’s role changes depending on what he / she is looking at is strange, to say the least.


    What I’m trying to do is to validate username and password each time the user hits "/auth/**" psth.

    OK, that kind of makes sense as a requirement. (Though, as a hypothetical user I would find it mysterious and/or annoying that simply navigating around the site cause me to be logged out.)

    But I don’t think you should do that by changing the user’s role(s) on the fly. If you do that you are liable to get "Permission denied" responses instead of redirects to the login page.

    What you really need to do is to put them back into the "not logged in" state. But even that can be a bit tricky. If pages in the /auth/** tree have links to stylesheets or script files, then when the browser fetches those links the security filters are liable to think that the user has navigated out of the /auth/** tree and log him out.

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

Sidebar

Related Questions

I have the following spring security configuration: <security:http> ...... <security:intercept-url pattern=/auth/** access=ROLE_ADMIN/> ......... </security:http>
I have the following declared in my spring security configuration file ( http://www.springframework.org/schema/security/spring-security-2.0.1.xsd ):
I would like to configure spring MVC application using Spring security the following way.
I have the following string and I would like to remove <bpt *>*</bpt> and
I currently running into trouble with spring security, I have been following the two
I have integrated Spring Security in my application and have defined access levels to
I'm using Spring 3.0 along with Spring Security. I've always used the following configuration:
I have the following situation: my application's authorization mechanism is implemented using Spring security.
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager
I have the following class (from a simple Spring tutorial) public class CarValidator implements

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.