mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-18 17:48:03 +08:00
增加 ticket 的 client 锁定功能
This commit is contained in:
@@ -42,7 +42,12 @@ sa.ajax = function(url, data, successFn) {
|
||||
// ----------------------------------- 相关事件 -----------------------------------
|
||||
|
||||
// 检查当前是否已经登录,如果已登录则直接开始跳转,如果未登录则等待用户输入账号密码
|
||||
sa.ajax("/sso/getRedirectUrl", {redirect: getParam('redirect', ''), mode: getParam('mode', '')}, function(res) {
|
||||
var pData = {
|
||||
client: getParam('client', ''),
|
||||
redirect: getParam('redirect', ''),
|
||||
mode: getParam('mode', '')
|
||||
};
|
||||
sa.ajax("/sso/getRedirectUrl", pData, function(res) {
|
||||
if(res.code == 200) {
|
||||
// 已登录,并且redirect地址有效,开始跳转
|
||||
location.href = decodeURIComponent(res.data);
|
||||
|
@@ -23,7 +23,7 @@ public class H5Controller {
|
||||
* 获取 redirectUrl
|
||||
*/
|
||||
@RequestMapping("/sso/getRedirectUrl")
|
||||
private Object getRedirectUrl(String redirect, String mode) {
|
||||
private Object getRedirectUrl(String redirect, String mode, String client) {
|
||||
// 未登录情况下,返回 code=401
|
||||
if(StpUtil.isLogin() == false) {
|
||||
return SaResult.code(401);
|
||||
@@ -35,7 +35,7 @@ public class H5Controller {
|
||||
return SaResult.data(redirect);
|
||||
} else {
|
||||
// 模式二或模式三
|
||||
String redirectUrl = SaSsoUtil.buildRedirectUrl(StpUtil.getLoginId(), redirect);
|
||||
String redirectUrl = SaSsoUtil.buildRedirectUrl(StpUtil.getLoginId(), client, redirect);
|
||||
return SaResult.data(redirectUrl);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user