1.zuul-server编写说明
zuul-server中需要做的就是当请求接口时,判断是 否登录鉴权,如果未登录,则跳转到auth-server的登录 界面(这里使用的是Spring Security OAuth的默认登录 界面,也可以重写相关代码定制页面),登录成功后 auth-server颁发jwt token,zuul-server在访问下游服务时 将jwt token放入header中即可。
编写核心配置文件bootstrap.yml,提供对引入框架的支持,如代码清单8-9所示:
代码中定义了从/client到client-a服务的路由规则, 比较重要的是security根下面的配置,验证授权端点 为http://localhost:7777/uaa/oauth/authorize,jwt token的 颁发地址为http://localhost:7777