OAuth2 Plugin
Description#
- The
OAuth2plugin is implemented usingWebflux OAuth2, used to supportOAuthprotocol.
Plugin Setting#
Please refer to the deployment document, choose a way to start shenyu-admin. For example, Local Deployment.
In
shenyu-adminBasicConfig --> plugin ->oauth2set to enable. If you don't want to use this function, please disable this plugin in theshenyu-admin.
Add configuration mode in plugin editing.
Plugin Use#
- Add support for
oauth2to the pom file of the gateway
<!-- apache shenyu oauth2 plugin start--> <dependency> <groupId>org.apache.shenyu</groupId> <artifactId>shenyu-spring-boot-starter-plugin-oauth2</artifactId> <version>${project.version}</version> </dependency> <!-- apache shenyu oauth2 plugin end--> - Configuration
oauth2atshenyu-bootstrap
spring: security: oauth2: client: registration: <your client-registration-id>: client-id: <your client-id> client-secret: <your client-secret> # the next part is authorize server‘s config provider: <your client-registration-id>: authorization-uri: <your authorization-uri> token-uri: <your access-token-uri> user-info-uri: <your user-info-uri> jwk-set-uri: <your jwk-set-uri>- Configure the relevant configuration of
spring.security.oauth2in the configuration file of the gateway. For detailed configuration instructions, please refer to Spring Webflux OAuth2 - Configure the selector and rule as the request address that you need
OAuth2authorization, and release all requests by default. For more instructions on selector and rule configuration, please refer to: Selector And Rule Config.