troubleshooting Question

need help with authorization - to show no access page

Avatar of huzefaq
huzefaq asked on
Java
7 Comments3 Solutions251 ViewsLast Modified:
I have a code which checks if a person is in priveliged group, if yes then the person is transferred to admin page otherwse he is transferred to the noAccess page.
The problem is that when the person is not in the priveliged group it still goes to the admin page as the link shows
        http://localhost.com/chapter_admin/alabama/
but the content is shown of the noAccess page.

Would anyone know why it is doing that and how can I fix it so the it goes to
    http://localhost.com/alabama/templates_public/noAccess.jsp
if the person is not athorized

thanks
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/* check to see that the user belongs to one of the privileged groups allowed to access the protected area */
    if(this.isInPrivilegedGroup(request_path, user_view_groups)) {
        /* yes, it's priviledged to access the wanted path...let him/her threw */
       chain.doFilter(request, response);
       return;
     }
     else {
        /* if we get here, that means the user does not belong to a privileged group(s) allowed access to the wanted area */
            request.setAttribute("DESTINATION", request_path);
            request.setAttribute("MESSAGE", "Sorry, you do not have access to the wanted URL...");
            ((HttpServletRequest)request).getRequestDispatcher("../templates_public/noAccess.jsp").forward((HttpServletRequest)request, (HttpServletResponse)response);
      }
ASKER CERTIFIED SOLUTION
Mick Barry
Java Developer
Join our community to see this answer!
Unlock 3 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros