基于@EnableOAuth2Sso实现单点登录

This commit is contained in:
2023-08-21 10:12:56 +08:00
parent c5f9146bac
commit c4256d46f9
11 changed files with 81 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ public class OAuth2Configuration extends AuthorizationServerConfigurerAdapter {
.withClient("web") //客户端名称,随便起就行
.secret(encoder.encode("654321")) //只与客户端分享的secret随便写但是注意要加密
.autoApprove(false) //自动审批,这里关闭,要的就是一会体验那种感觉
.redirectUris("http://localhost:8201/login") //可以写多个,当有多个时需要在验证请求中指定使用哪个地址进行回调
.redirectUris("http://localhost:8101/login", "http://localhost:8201/login", "http://localhost:8301/login") //可以写多个,当有多个时需要在验证请求中指定使用哪个地址进行回调
.scopes("book", "user", "borrow") //授权范围这里我们使用全部all
.authorizedGrantTypes("client_credentials", "password", "implicit", "authorization_code", "refresh_token");
//授权模式一共支持5种除了之前我们介绍的四种之外还有一个刷新Token的模式