Results 1 to 8 of 8

Thread: Handling UserDeniedVerificationException at consumer side

  1. #1
    Join Date
    Mar 2011
    Posts
    5

    Default Handling UserDeniedVerificationException at consumer side

    Hi,

    What is the best place where UserDeniedVerificationException can be caught at consumer side? This exception is thrown when user chooses to deny verification at provider. OAuth2ClientContextFilter does not handle this exception and I would like to send a redirect to a specific url.

    Should I implement a filter which would be a substitute for OAuth2ClientContextFilter and which would catch this exception? Or is there a more cleaner way to do exception handling in this case?

    Thanks,
    Marko

  2. #2
    Join Date
    May 2008
    Location
    Salt Lake City
    Posts
    167

    Default

    Perhaps a custom AuthenticationEntryPoint and/or AccessDeniedHandler?

    http://static.springsource.org/sprin...slation-filter

  3. #3
    Join Date
    Mar 2011
    Posts
    5

    Default

    ah, yes.. ExceptionTranslationFilter sounds like a right place to handle this exception.. thanks

  4. #4
    Join Date
    Mar 2011
    Posts
    5

    Default

    There is a problem with this solution. ExceptionProcessingFilter stands and the very end of filter chain and it does not catch exceptions thrown by Oauth2ClientContextFilter or OAuth2ClientProcessingFilter

  5. #5
    Join Date
    May 2008
    Location
    Salt Lake City
    Posts
    167

    Default

    If you're using the standard namespace configuration, the spring security filters are being added after the ExceptionTranslationFilter so it should see any exceptions in the oauth2 context or processing filter(s).

  6. #6
    Join Date
    Mar 2011
    Posts
    5

    Default

    Quote Originally Posted by stoicflame View Post
    If you're using the standard namespace configuration, the spring security filters are being added after the ExceptionTranslationFilter so it should see any exceptions in the oauth2 context or processing filter(s).
    I'm not using standard namespace configuration. This is the order of filters in my application:
    <sec:filter-chain pattern="/facebookLoginService/**" filters="channelProcessingFilter,sessionContextInt egrationFilter,oauth2ClientContextFilter,ssoRememb erMeAuthenticationProcessingFilter,ssoValidationAu thenticationProcessingFilter,logoutFilter,anonymou sProcessingFilter,oauth2ClientProcessingFilter,exc eptionTranslationFilter,filterInvocationIntercepto r" />

  7. #7
    Join Date
    May 2008
    Location
    Salt Lake City
    Posts
    167

    Default

    How come you can't add the oauth2 filters after the exception translation filter?

  8. #8
    Join Date
    Mar 2011
    Posts
    5

    Default

    Quote Originally Posted by stoicflame View Post
    How come you can't add the oauth2 filters after the exception translation filter?
    I've tried to put oauth processing filter after exception translation filter, but forgot to move oauth context filter also after exception translation filter so etf was catching exceptions thrown by oauth context filter which were should have been caught by oauth processing filter...

    now both filters are after exception translation filter, and it works.

    thanks for your help

Posting Permissions

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