美文网首页
spring oauth重定向流程

spring oauth重定向流程

作者: 提米锅锅 | 来源:发表于2020-03-15 12:07 被阅读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

相关文章

网友评论

      本文标题:spring oauth重定向流程

      本文链接:https://www.haomeiwen.com/subject/lkicehtx.html