Skip to content

andyzhaozhao/cloud-oauth2-jwt-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

本项目使用了spring security5.x的新的oauth2包,参考: spring boot 2和spring cloud G版本Oauth2功能包依赖说明

文档

开发者社区博客文档:Spring Cloud基于Oauth2的认证和鉴权

运行

本项目支持okta和TDF-oauth-server

  1. 运行eureka
  2. 运行zuul
  3. 运行resource
  4. 运行openfeign

浏览器输入:http://localhost:8080/openfeign/dc

浏览器显示字符串:Services: [zuul, resource, openfeign]

微服务体系

  • eureka:是Eureka Server
  • zuul: 是基于zuul的网关,代理resource和openfeign
  • resource;普通微服务
  • openfeign: 通过openfeign调用resource

eureka

服务发现中心

zuul

引用了spring-boot-starter-oauth2-client包,作为okta的client。自定义OAuth2TokenRelayFilter,做token relay操作

resource

引用了pring-boot-starter-oauth2-resource-server作为资源服务器,配置:jwk-set-uri

openfeign

引用了pring-boot-starter-oauth2-resource-server作为资源服务器。自定义了RequestInterceptor,做token relay操作

遇到的问题

  1. zuul项目注释中的其他认证服务器同时存在时候,zuul项目启动会报错,目前只配置使用okta作为认证服务器

联系人

zhaozhao@mail.taiji.com.cn

参考

About

spring cloud的oauth2示例

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages