# oauth2_1
**Repository Path**: mlrl-gitee/oauth2_1
## Basic Information
- **Project Name**: oauth2_1
- **Description**: https://gitee.com/mlrl/oauth2_1
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2023-06-14
- **Last Updated**: 2024-04-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 使用 OpenID
OpenID Connect 1.0规范
OpenID认证
## 前置动作:映射 host 到127.0.0.1,避免域的问题导致访问不成功
```
127.0.0.1 client
127.0.0.1 auth
127.0.0.1 resource
```
## 1、启动 `AuthorizationServer` `client` 并访问 web 链接
GET http://client:5000/oauth2/authorization/client-openid
> 默认访问路径:`http://client:5000/oauth2/authorization/{registrationId}`
>
> 此时会被重定向到地址:
> `http://auth:4000/oauth2/authorize?response_type=code&client_id=client-openid&scope=read%20openid&state=XXX`
>
> 或自己手动拼装此 url 亦可
## 2、账号密码:john 12345
## 3、勾选,提交
> 提交后被重定向:
> `http://client:5000/login/oauth2/code/client-openid?code=XXX
>
> 默认重定向模板是: `{baseUrl}/login/oauth2/code/{registrationId}`
>
> 使用了OpenID,所以其内部自动处理此链接,再次重定向到最初需要访问的界面