Results 1 to 3 of 3

Thread: Get original request URL from Acegi??

  1. #1
    Join Date
    Mar 2007
    Posts
    24

    Default 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. #2
    Join Date
    Mar 2007
    Posts
    24

    Default

    Hi,

    I really would appreciate any ideas....

    Thanks Aron

  3. #3
    Join Date
    Mar 2007
    Posts
    24

    Default

    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;
      }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •