wiki-files/wg-basic/oauth2.md

66 lines
1.6 KiB
Markdown
Raw Normal View History

2021-09-24 14:28:38 +08:00
---
2021-09-24 14:58:36 +08:00
title: 9.OAuth2单点登录
description: OAuth2单点登录服务端与客户端配置
2021-09-24 14:28:38 +08:00
published: true
2021-11-01 10:50:08 +08:00
date: 2021-11-01T02:50:07.132Z
2021-09-24 14:28:38 +08:00
tags: wg-basic
editor: markdown
dateCreated: 2021-09-24T06:28:37.207Z
---
# OAuth2认证端
## 依赖
2021-09-24 14:48:55 +08:00
```xml
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>login-oauth2-server</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
```
## 添加菜单
添加客户端管理 `/route/oauth2client/list`
2021-09-24 14:28:38 +08:00
# OAuth2客户端
2021-09-24 14:48:55 +08:00
> 注意OAuth2客户端引入之后无需再引入其他 login-* 模块
{.is-warning}
2021-09-24 14:28:38 +08:00
## 依赖
2021-09-24 14:48:55 +08:00
```xml
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>login-oauth2-client</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
```
2021-09-24 14:28:38 +08:00
## 配置
2021-09-24 14:48:55 +08:00
```yaml
# 安全
security:
oauth2:
oauth-server: OAuth2认证服务外网地址
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: 由OAuth2认证端提供的ClientId
client-secret: 由OAuth2认证端提供的ClientSecret
user-authorization-uri: ${security.oauth2.oauth-server}/oauth2_client/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth2_client/token
grant-type: authorization_code
resource:
jwt:
key-uri: ${security.oauth2.oauth-server}/oauth2_client/token_key
token-info-uri: ${security.oauth2.oauth-server}/oauth2_client/check_token
user-info-uri: ${security.oauth2.oauth-server}/user
authorization:
check-token-access: ${security.oauth2.oauth-server}/oauth2_client/token_key
2021-11-01 10:50:08 +08:00
2021-10-25 17:36:08 +08:00
api-path:
user-center: http://127.0.0.1:7011/usercenter
2021-11-01 10:50:08 +08:00
2021-09-24 14:48:55 +08:00
```