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 7821149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:32:52+00:00 2026-06-02T07:32:52+00:00

Question 1: i have set up spring security in my application but now i

  • 0

Question 1:

i have set up spring security in my application but now i have a little weird problem.
what i have learned from spring security is, you dont need to add this line of code @RolesAllowed({"ROLE_ADMIN"}) above your method if you set this up

<sec:http auto-config="true" access-denied-page="/faces/accessDenied.xhtml">
    <sec:form-login login-page="/faces/login.xhtml" />
    <sec:intercept-url pattern="/faces/admin/**" access="ROLE_ADMIN" />
</sec:http>

but apparently i can go to the page that is in the “/faces/admin” folder without spring security redirects me to the login page.

Question 2:

When i have the @RolesAllowed({"ROLE_ADMIN"}) code above my method, it redirects me to the login page and works correctly but with this one, i got access denied error in my console with bunch of error codes (application still runs correctly though). is it OK that i get access denied errors in the console or if not what is the best way to handle it ?

i still want to have the restricted pages folder and do not have to write @RolesAllowed above all the methods that are in the admin folder.

PS: it is a JSF 2.0 project.

thanks in advance, cheers.

  • 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-02T07:32:55+00:00Added an answer on June 2, 2026 at 7:32 am

    Question 1: I think you are missing the DelegatingFilterProxy in your web.xml. Configure like this:

    <filter>
      <filter-name>springSecurityFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    
    <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>
    

    And configure the http element as below:

    <http auto-config="true" >
       <intercept-url pattern="/faces/login.xhtml*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
       <intercept-url pattern="/faces/admin/**" access="ROLE_ADMIN" />
       <access-denied-handler error-page="/faces/accessDenied.xhtml" />
       <form-login login-page='/faces/login.xhtml' default-target-url='/faces/index.xhtml'
            always-use-default-target='true'/>
    </http>
    

    And instead of the access-denied-page attribute, use access-denied-handler as the above attribute is deprecated.Source

    Question 2: Yes, this is normal if you set your log level to DEBUG and access the protected resource the first time as an anonymous user. See 1.3 of this FAQ

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

Sidebar

Related Questions

I have no good title for this question, but my problem is to set
My question is motivated by the following problem. I have a set of web
We're developing a data heavy modular web application stack with java but have little
I'm using spring-security web authentication with spring-mvc, all is well so far, but now
I have to set GridView.DataKeyNames (This is really a question about the syntax for
Quick question I have a database with snapshot enabled using ALTER DATABASE myDB SET
T-SQL DateTime Question. I have a set of time ranges. During those time ranges
This question is for experiences programmers. Do you have a set process that you
I have a question about how to set up the relations between two models
I have a question. How Can I set font for example: Harrington in textview.

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.