spring oauth重定向流程

2020-03-15  本文已影响0人  提米锅锅

OAuth2ClientContextFilter会抛出异常,然后在catch里进行重定向

        try {
            chain.doFilter(servletRequest, servletResponse);
        } catch (IOException ex) {
            throw ex;
        } catch (Exception ex) {
            // Try to extract a SpringSecurityException from the stacktrace
            Throwable[] causeChain = throwableAnalyzer.determineCauseChain(ex);
            UserRedirectRequiredException redirect = (UserRedirectRequiredException) throwableAnalyzer
                    .getFirstThrowableOfType(
                            UserRedirectRequiredException.class, causeChain);
            if (redirect != null) {
                redirectUser(redirect, request, response);
            } else {

                throw new NestedServletException("Unhandled exception", ex);
            }
        }

UserRedirectRequiredException 包含了需要重定向的所有信息:
核心的就是redirect url


image.png
上一篇 下一篇

猜你喜欢

热点阅读