@ 模拟器/微软
Microsoft Entra ID (Azure AD) v2.0 OAuth 2.0和OpenID Connect 模拟 授权代码流,PKCE,客户端证书,客户端的刷新令牌,RS256ID令牌,以及OIDC的发现.
部分 模拟 ——为CI和无网络沙盒提供本地出入口替换服务.
安装
npm install @emulators/microsoft
终点
GET /.well-known/openid-configuration- OIDC发现文件GET /:tenant/v2.0/.well-known/openid-configuration租户范围GET /discovery/v2.0/keys——JSON网络密钥集(JWKS)GET /oauth2/v2.0/authorize——授权终点(显示取用器)POST /oauth2/v2.0/token——信使交换(授权代码,刷新信使,客户资格)GET /oidc/userinfo— OpenID 连接用户信息GET /v1.0/me— 微软图形用户配置GET /v1.0/users/:id– 微软图形用户用IDGET /oauth2/v2.0/logout—结束会话/停用POST /oauth2/v2.0/revoke- 撤销证书
认证
由PKCE支持的OIDC授权代码流. 还支持客户证书赠款。 当OAuth客户端配置时,刷新令牌只能被接收到的客户端和有效客户端证书所使用. 保留保存的客户端不绑定的保存记录 。 微软图形 /v1.0/me 可用.
刷新鼠标
curl -X POST http://localhost:4005/oauth2/v2.0/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "refresh_token=r_microsoft_...&\
client_id=example-client-id&\
client_secret=example-client-secret&\
grant_type=refresh_token"
需要更新请求 client_id 财务报告和审定财务报表 client_secret 给收到刷新令牌的客户。 符号在成功请求后旋转 . Authorization: Basic 可用于客户证书.
种子配置
microsoft:
users:
- email: [email protected]
name: Test User
oauth_clients:
- client_id: example-client-id
client_secret: example-client-secret
name: My Microsoft App
redirect_uris:
- http://localhost:3000/api/auth/callback/microsoft-entra-id