首页 > 代码库 > zuul sample

zuul sample

https://github.com/kakawait/uaa-behind-zuul-sample/

 

1.参考资料

项目:https://github.com/kakawait/uaa-behind-zuul-sample/,按照这个项目实现后,虽然会跳转到认证服务的登录页,但登录成功后无法跳转回来,原因是做了二次302,但302的过程中将一些信息丢了,查原因是,主要跟踪了下面的类

预过滤器:

0 = {ServletDetectionFilter@9816} ,确定是否支持Dispatch请求
1 = {Servlet30WrapperFilter@9817} ,进行Servlet30请求包装
2 = {FormBodyWrapperFilter@9818} ,FormBody包装
3 = {DebugFilter@9819} 
4 = {PreDecorationFilter@9820} 
5 = {AuthenticationHeaderFilter@9821} ,addIgnoredHeaders不知道是啥意思
6 = {OAuth2TokenRelayFilter@9441} ,这个被跳过了,不知道是否可以直接disable算了

   ctx.addZuulRequestHeader("authorization", ctx.get(TOKEN_TYPE) + " " + getAccessToken(ctx));

正式过滤器:

0 = {RibbonRoutingFilter@9478} 
1 = {SimpleHostRoutingFilter@9669} 
2 = {SendForwardFilter@9692} 

 

2.zuul中主要的类

2.1 ZuulController

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {}

2.2 RibbonRoutingFilter

zuul sample