diff --git a/zlt-commons/zlt-common-core/pom.xml b/zlt-commons/zlt-common-core/pom.xml index 55e6d54036d67f828cab35340b7893b89b1f789d..693f390c8afe126e59216d641f7fe97b4d72342e 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 diff --git a/zlt-demo/sso-demo/oidc-sso/README.md b/zlt-demo/sso-demo/oidc-sso/README.md index 672698d86520c5ef79232c38681215b0c0484f67..1111650873a7b35e5e7eff35e8fcd22366a1247d 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 74103b05339df2710f1ef7d16393de2fa0b5feaf..72e3ff03080660a5d01fce3c2d783635200b21e9 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 fc4c658e0de976fe87284baf9386154d0ca8a442..bb422ead288bdf923d2ca3adb922396a623429e4 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 6405352c65e8bf63149d6518a8c86c4765796a49..bdf168fc8135cfa2beedd7c55a848b5aecc050d6 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