Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Custom AuthenticationProcessingFilterEntryPoint

  1. #1
    Join Date
    Dec 2006
    Posts
    4

    Question Custom AuthenticationProcessingFilterEntryPoint

    Hi,
    i want to change the AuthenticationProcessingFilterEntryPoint to check if exists a cookie. If the cookie exists, i want to send its informations to the authentication manager. If the cookie doesn't exist, i want to show the form authentication.

    How can i do it ?

    Thanks a lot.

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    I'm not sure what your trying to do, but that just sounds like remember me authentication. This already exists, just check out the examples that ship with acegi. They demo using it.

  3. #3
    Join Date
    Dec 2006
    Posts
    4

    Question

    Quote Originally Posted by karldmoore View Post
    I'm not sure what your trying to do, but that just sounds like remember me authentication. This already exists, just check out the examples that ship with acegi. They demo using it.
    Now I using form authentication. But i want skip "form authentication" when exist a my coockie. And use for authentication process the info inside a coockie.

    Thanks a lot.

    Nietzsche.

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    All I can say is, see previous statement. Again this said exactly like the remember me authentication. Have you had a look at the Acegi example? If not this should show you how to do it. If you have and still have questions, what are the questions?

  5. #5
    Join Date
    Dec 2006
    Location
    Phoenix, AZ
    Posts
    6

    Default

    Pretty sure you would have to place RememberMeProcessingFilter before your form authentication filter for this to work. I assume this since you say you want the cookie to override any form authentication.

    It also seems you need the TokenBasedRememberMeServices and not the default NullRememberMeServices configured.

    The TokenBased definitely looks for a cookie and uses that for authentication unless the token is expired or simply doesn't exist (or if the user is not valid).

    This is under the providers.rememberme.* package.

  6. #6
    Join Date
    Dec 2006
    Posts
    4

    Default

    Quote Originally Posted by kellewic View Post
    Pretty sure you would have to place RememberMeProcessingFilter before your form authentication filter for this to work. I assume this since you say you want the cookie to override any form authentication.

    It also seems you need the TokenBasedRememberMeServices and not the default NullRememberMeServices configured.

    The TokenBased definitely looks for a cookie and uses that for authentication unless the token is expired or simply doesn't exist (or if the user is not valid).

    This is under the providers.rememberme.* package.
    I extends AuthenticationProcessingFilter and modify doFilter.

    If exist my custom cookie i run:

    Code:
    onPreAuthentication(httpRequest, httpResponse);
    Create my custom token

    Code:
    authRequest = new CustomAuthenticationToken(custominfo1, custominfo2));
    authRequest.setDetails(new WebAuthenticationDetails(httpRequest));
    authenticate my token

    Code:
    Authentication auth = this.getAuthenticationManager().authenticate(authRequest);
    Set context

    Code:
    SecurityContextHolder.getContext().setAuthentication(auth);
    and
    Code:
    successfulAuthentication(httpRequest, httpResponse, auth);
    If I have a error use.

    Code:
    unsuccessfulAuthentication(((HttpServletRequest) request), ((HttpServletResponse) response), authenticationException);

  7. #7
    Join Date
    Dec 2006
    Posts
    13

    Default Did you find an answer to this issue?

    Hi, Did you find an answer to this issue?

    Regards,

    David Castaneda

  8. #8
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    Quote Originally Posted by kellewic View Post
    Pretty sure you would have to place RememberMeProcessingFilter before your form authentication filter for this to work. I assume this since you say you want the cookie to override any form authentication.
    This isn't correct. The authentication processing filter is only triggered by the form login url, so the order doesn't matter. See the contacts sample, for example.

    RememberMeProcessingFilter *is* used for cookie-based authentication but Nietzsche seems to be searching for meaning elsewhere :-).

  9. #9
    Join Date
    Dec 2006
    Posts
    13

    Default Thanks a lot

    Thanks a lot for this reply... Actually I make it work... without rememberme services as it seems to be too much overhead maybe I'm wrong right now I need to make it work but I'll review it again later and let you know....

    Regards...


    David Casta~eda

  10. #10
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Quote Originally Posted by Luke View Post
    RememberMeProcessingFilter *is* used for cookie-based authentication but Nietzsche seems to be searching for meaning elsewhere :-).
    Glad I'm not alone on this one .

Posting Permissions

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