From bf700ab1fc79d23b882533981517217e70ef627e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 4 Oct 2022 23:11:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20yudao-sso-demo-by-password?= =?UTF-8?q?=20=E7=A4=BA=E4=BE=8B=EF=BC=8C=E5=9F=BA=E4=BA=8E=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=A8=A1=E5=BC=8F=EF=BC=8C=E5=AE=9E=E7=8E=B0=20SSO=20?= =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/ssodemo/client/OAuth2Client.java | 2 +- .../src/main/resources/static/login.html | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/client/OAuth2Client.java b/yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/client/OAuth2Client.java index b5f971989..4f6b63481 100644 --- a/yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/client/OAuth2Client.java +++ b/yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/client/OAuth2Client.java @@ -31,7 +31,7 @@ public class OAuth2Client { */ public static final Long TENANT_ID = 1L; - private static final String CLIENT_ID = "yudao-sso-demo-by-code"; + private static final String CLIENT_ID = "yudao-sso-demo-by-password"; private static final String CLIENT_SECRET = "test"; diff --git a/yudao-example/yudao-sso-demo-by-password/src/main/resources/static/login.html b/yudao-example/yudao-sso-demo-by-password/src/main/resources/static/login.html index 4dd6a9105..79b866bf2 100644 --- a/yudao-example/yudao-sso-demo-by-password/src/main/resources/static/login.html +++ b/yudao-example/yudao-sso-demo-by-password/src/main/resources/static/login.html @@ -13,31 +13,31 @@ */ function login() { const clientId = 'yudao-sso-demo-by-password'; // 可以改写成,你的 clientId - const clientSecret = 'test'; // 可以改写成,你的 clientSecret - const grantType = 'password'; // 密码模式 + const clientSecret = 'test'; // 可以改写成,你的 clientSecret + const grantType = 'password'; // 密码模式 - // 账号 + 密码 - const username = $('#username').val(); - const password = $('#password').val(); + // 账号 + 密码 + const username = $('#username').val(); + const password = $('#password').val(); if (username.length === 0 || password.length === 0) { alert('账号或密码未输入'); return; - } + } // 发起请求 $.ajax({ url: "http://127.0.0.1:48080/admin-api/system/oauth2/token?" // 客户端 - + "client_id=" + clientId + + "client_id=" + clientId + "&client_secret=" + clientSecret - // 密码模式的参数 - + "&grant_type=" + grantType - + "&username=" + username - + "&password=" + password - + '&scope=user.read user.write', + // 密码模式的参数 + + "&grant_type=" + grantType + + "&username=" + username + + "&password=" + password + + '&scope=user.read user.write', method: 'POST', headers: { - 'tenant-id': '1', // 多租户编号,写死 + 'tenant-id': '1', // 多租户编号,写死 }, success: function (result) { if (result.code !== 0) { @@ -57,9 +57,9 @@ - 账号:
- 密码:
- +账号:
+密码:
+