Spring Cloud OAuth2 & Zuul

Spring Cloud OAuth2 整合 Zuul有两种用法。

反向代理

具体的权限配置信息在反向代理的微服务里配置,也就是具体的鉴权操作在各个资源服务器。

反向代理+权限控制

也就是Zuul Server不仅是反向代理的角色,还需要承担鉴权的职责,如果需要鉴权,在Spring Security中就需要两步,
1. 的access_token变成OAuth2Authentication的操作,
Extracts an OAuth2 token from the incoming request and uses it to populate the Spring Security context with an {@link OAuth2Authentication}
2. 鉴权,Spring Security中从TokenStore到AuthenticationProvider到AuthenticationManager等一整套组件;
也就是说需要将ZuulServer配置成一个ResourceServer,生成OAuth2AuthenticationProcessingFilter和鉴权相关的Bean;

你可能感兴趣的:(Spring,Security)