1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- server:
- port: 7000
- spring:
- application:
- name: gateway
- security:
- oauth2:
- # 资源服务器配置
- resourceserver:
- jwt:
- # Jwt中claims的iss属性,也就是jwt的签发地址,即认证服务器的根路径
- # 资源服务器会进一步的配置,通过该地址获取公钥以解析jwt
- issuer-uri: http://www.test.com:8080
- client:
- provider:
- # 认证提供者,自定义名称
- custom-issuer:
- # Token签发地址(认证服务地址)
- issuer-uri: http://www.test.com:8080
- # 获取用户信息的地址,默认的/userinfo端点需要IdToken获取,为避免麻烦自定一个用户信息接口
- user-info-uri: ${spring.security.oauth2.client.provider.custom-issuer.issuer-uri}/user
- user-name-attribute: name
- registration:
- messaging-client-oidc:
- # oauth认证提供者配置,和上边配置的认证提供者关联起来
- provider: custom-issuer
- # 客户端名称,自定义
- client-name: gateway
- # 客户端id,从认证服务申请的客户端id
- client-id: messaging-client
- # 客户端秘钥
- client-secret: 123456
- # 客户端认证方式
- client-authentication-method: client_secret_basic
- # 获取Token使用的授权流程
- authorization-grant-type: authorization_code
- # 回调地址,这里设置为Spring Security Client默认实现使用code换取token的接口
- redirect-uri: http://127.0.0.1:7000/login/oauth2/code/messaging-client-oidc
- scope:
- - message.read
- - message.write
- - openid
- - profile
- cloud:
- gateway:
- default-filters:
- # 令牌中继
- - TokenRelay=
- # 代理路径,代理至服务后会去除第一个路径的内容
- - StripPrefix=1
- routes:
- # 资源服务代理配置
- - id: auth
- uri: http://localhost:8080
- predicates:
- - Path=/auth/**
- # 资源服务代理配置
- - id: webmvc
- uri: http://localhost:7200
- predicates:
- - Path=/webmvc/**
- # 资源服务代理配置
- - id: webflux
- uri: http://localhost:7100
- predicates:
- - Path=/webflux/**
|