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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:31:02+00:00 2026-05-22T02:31:02+00:00

I have a JSF2 (GlassFish 3.0) application which security constraints defined (example below). My

  • 0

I have a JSF2 (GlassFish 3.0) application which security constraints defined (example below). My problem is, I have a “sign up” link that should not be accessible when the user is logged in.

That is, if they try to hit “/signup.jsf” they should be able to access is if they are logged; so if the have any roles, they should not be able to see the page.

Is there a way to do an “inverse” security constraint like that?

Any suggestions are welcome, thanks!
Rob

Example constraint from my app, in case that’s useful:

<security-constraint>
    <display-name>profileForm</display-name>
    <web-resource-collection>
        <web-resource-name>profileForm</web-resource-name>
        <url-pattern>/profileForm.jsf</url-pattern>
        <http-method>DELETE</http-method>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
        <http-method>PUT</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>GENERAL</role-name>
        <role-name>ADMIN</role-name>
        <role-name>STAFF</role-name>
        <role-name>INSTRUCTOR</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
  • 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-22T02:31:03+00:00Added an answer on May 22, 2026 at 2:31 am

    Just create a Filter which does exactly that.

    @WebFilter(urlPatterns={"/signup.jsf"})
    public class SignupFilter implements Filter {
        
        @Override
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
            // ...
    
            if (userIsLoggedIn) {
                ((HttpServletResponse) response).sendRedirect("already_loggedin.jsf");
            } else {
                chain.doFilter(request, response);
            }
        }
    
        // ...
    }
    

    There is really nothing which standard JSF offers out the box with regard to authorization/authentication. JSF is just a component based MVC framework.

    See also:

    • Our Servlet Filters wiki page
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSF2 application that uses Spring 3.0. I have a bean that
Technology(Java EE 6 with Glassfish 3.1, Netbeans 7.0) I have an application client that
I'm using JSF2 on GlassFish 3. I have a form that accepts and optional
In my JSF2 application I have a phaselistener that needs to be executed before
I have a JSF 2.0 application running on GlassFish v3. It has EJBs that
I have a web application currently deployed in jetty8, which is based on jsf2,
I have some problem's with a simple application in JSF 2.0. I try to
I have a JavaEE6-application running on Glassfish v3.0.1 with EJB 3.1 (app is packaged
[My Setup: Java EE 6 application, with EJB3.1, CDI/Weld, JSF2 running on Glassfish 3.0.1]
I have simple JSF2 application running on glashfish 3.1. I want to add a

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.