From 44d0a795b013f7ac76f4e38fd86fcbf9608630aa Mon Sep 17 00:00:00 2001 From: zhult13 Date: Fri, 9 Sep 2022 15:18:18 +0800 Subject: [PATCH 1/2] fix #I5Q1B3 --- zlt-commons/zlt-common-core/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zlt-commons/zlt-common-core/pom.xml b/zlt-commons/zlt-common-core/pom.xml index 55e6d540..693f390c 100644 --- a/zlt-commons/zlt-common-core/pom.xml +++ b/zlt-commons/zlt-common-core/pom.xml @@ -16,8 +16,7 @@ com.baomidou - mybatis-plus - true + mybatis-plus-extension org.springframework.social -- Gitee From 5046129e8040b85e01b00e5e467c1540404cafc1 Mon Sep 17 00:00:00 2001 From: zhult13 Date: Sat, 17 Sep 2022 12:39:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Doidc-sso=E6=A0=B7?= =?UTF-8?q?=E4=BE=8B=E5=B7=A5=E7=A8=8B=E7=9A=84=E6=95=B0=E6=8D=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zlt-demo/sso-demo/oidc-sso/README.md | 1 + .../src/main/java/com/sso/demo/controller/ApiController.java | 5 ++++- zlt-demo/sso-demo/oidc-sso/src/main/resources/bootstrap.yml | 3 ++- zlt-doc/sql/oauth-center.sql | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/zlt-demo/sso-demo/oidc-sso/README.md b/zlt-demo/sso-demo/oidc-sso/README.md index 672698d8..11116508 100644 --- a/zlt-demo/sso-demo/oidc-sso/README.md +++ b/zlt-demo/sso-demo/oidc-sso/README.md @@ -11,6 +11,7 @@ alter table oauth_client_details add support_id_token tinyint(1) DEFAULT 1 COMME alter table oauth_client_details add id_token_validity int(11) DEFAULT 60 COMMENT 'id_token有效期'; update oauth_client_details set additional_information = '{"LOGOUT_NOTIFY_URL_LIST":"http://127.0.0.1:8082/logoutNotify"}' + , web_server_redirect_uri = 'http://127.0.0.1:8082/callback.html' where client_id = 'webApp'; ``` diff --git a/zlt-demo/sso-demo/oidc-sso/src/main/java/com/sso/demo/controller/ApiController.java b/zlt-demo/sso-demo/oidc-sso/src/main/java/com/sso/demo/controller/ApiController.java index 74103b05..72e3ff03 100644 --- a/zlt-demo/sso-demo/oidc-sso/src/main/java/com/sso/demo/controller/ApiController.java +++ b/zlt-demo/sso-demo/oidc-sso/src/main/java/com/sso/demo/controller/ApiController.java @@ -50,6 +50,9 @@ public class ApiController { @Value("${zlt.sso.redirect-uri:}") private String redirectUri; + @Value("${zlt.sso.scope:}") + private String scope; + @Value("${zlt.sso.access-token-uri:}") private String accessTokenUri; @@ -146,7 +149,7 @@ public class ApiController { param.add("code", code); param.add("grant_type", "authorization_code"); param.add("redirect_uri", redirectUri); - param.add("scope", "all"); + param.add("scope", scope); param.add("nonce", this.genNonce()); HttpEntity> request = new HttpEntity<>(param, headers); ResponseEntity response = restTemplate.postForEntity(accessTokenUri, request , Map.class); diff --git a/zlt-demo/sso-demo/oidc-sso/src/main/resources/bootstrap.yml b/zlt-demo/sso-demo/oidc-sso/src/main/resources/bootstrap.yml index fc4c658e..bb422ead 100644 --- a/zlt-demo/sso-demo/oidc-sso/src/main/resources/bootstrap.yml +++ b/zlt-demo/sso-demo/oidc-sso/src/main/resources/bootstrap.yml @@ -11,4 +11,5 @@ zlt: client-secret: webApp redirect-uri: http://127.0.0.1:8082/callback.html access-token-uri: http://127.0.0.1:9900/api-uaa/oauth/token - jwt-key-uri: http://127.0.0.1:9900/api-uaa/tokens/key \ No newline at end of file + jwt-key-uri: http://127.0.0.1:9900/api-uaa/tokens/key + scope: app \ No newline at end of file diff --git a/zlt-doc/sql/oauth-center.sql b/zlt-doc/sql/oauth-center.sql index 6405352c..bdf168fc 100644 --- a/zlt-doc/sql/oauth-center.sql +++ b/zlt-doc/sql/oauth-center.sql @@ -30,6 +30,6 @@ CREATE TABLE `oauth_client_details` ( -- ---------------------------- -- Records of oauth_client_details -- ---------------------------- -INSERT INTO `oauth_client_details` VALUES (1, 'webApp', NULL, '$2a$10$06msMGYRH8nrm4iVnKFNKOoddB8wOwymVhbUzw/d3ZixD7Nq8ot72', 'webApp', 'app', 'authorization_code,password,refresh_token,client_credentials,implicit,password_code,openId,mobile_password', NULL, NULL, 3600, NULL, '{"LOGOUT_NOTIFY_URL_LIST":"http://127.0.0.1:8082/logoutNotify"}', 'true', NULL, NULL, 'pc端', 1, 60); +INSERT INTO `oauth_client_details` VALUES (1, 'webApp', NULL, '$2a$10$06msMGYRH8nrm4iVnKFNKOoddB8wOwymVhbUzw/d3ZixD7Nq8ot72', 'webApp', 'app', 'authorization_code,password,refresh_token,client_credentials,implicit,password_code,openId,mobile_password', 'http://127.0.0.1:8082/callback.html', NULL, 3600, NULL, '{"LOGOUT_NOTIFY_URL_LIST":"http://127.0.0.1:8082/logoutNotify"}', 'true', NULL, NULL, 'pc端', 1, 60); INSERT INTO `oauth_client_details` VALUES (2, 'app', NULL, '$2a$10$i3F515wEDiB4Gvj9ym9Prui0dasRttEUQ9ink4Wpgb4zEDCAlV8zO', 'app', 'app', 'authorization_code,password,refresh_token', 'http://127.0.0.1:8081/callback.html', NULL, 3600, NULL, '{"LOGOUT_NOTIFY_URL_LIST":"http://127.0.0.1:8081/logoutNotify"}', 'true', NULL, NULL, '移动端', 1, 60); INSERT INTO `oauth_client_details` VALUES (3, 'zlt', NULL, '$2a$10$/o.wuORzVcXaezmYVzwYMuoY7qeWXBALwQmkskXD/7C6rqfCyPrna', 'zlt', 'all', 'authorization_code,password,refresh_token,client_credentials', 'http://127.0.0.1:8080/singleLogin', NULL, 3600, 28800, '{}', 'true', '2018-12-27 00:50:30', '2018-12-27 00:50:30', '第三方应用', 1, 60); \ No newline at end of file -- Gitee