Announcement Announcement Module
Collapse
No announcement yet.
Get original request URL from Acegi?? Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get original request URL from Acegi??

    Hi,

    To make Acegi run with JSF, we dedided to implement the login with a backing bean and not to use AuthenticationProcessingFilter (otheriwse Acegi is not working with JSF). Our bean just mimics the behavior of this filter and works well.

    Now we are running into the following problem: if a user tries to access a protected URL, he or she is not granted for, Acegi redirects the user to the login page (This is how it should be). But after a successful login, we want the user to end up on the original URL that he or she tried to access. Since we are handling the login in a JSF bean, we need to redirect the user to the original URL after a successful login. Is there any chance to get that URL out of the acegi context, from the FilterSecurityInterceptor or some other acegi resource?

    Thanks Aron

  • #2
    Hi,

    I really would appreciate any ideas....

    Thanks Aron

    Comment


    • #3
      I solved it myself.
      Just for the protocol (and others having the same problem), you can receive the original URL from the session attribute map where the full request is saved:

      Code:
        
      private String obtainFullRequestUrl(HttpServletRequest request) {
          HttpSession tmpSession;
          SavedRequest tmpSavedRequest;
          String tmpUrl = null;
      
          tmpSession = request.getSession();
          tmpSavedRequest = (SavedRequest) tmpSession.getAttribute(AbstractProcessingFilter.ACEGI_SAVED_REQUEST_KEY);
          if (null != tmpSavedRequest) {
            tmpUrl = tmpSavedRequest.getRequestURL();
          }
          return tmpUrl;
        }

      Comment

      Working...
      X