将 SaSsoConfig 中不必要的 get set 标注为过期

This commit is contained in:
click33
2024-04-27 17:36:00 +08:00
parent 21a4f66595
commit bd313849fc
9 changed files with 56 additions and 38 deletions

View File

@@ -30,22 +30,22 @@ public class SsoConfig {
public void configSso(SaSsoConfig sso) { //SaSsoConfig 已自动构建
// 配置未登录时返回的View
sso.setNotLoginView(() -> {
sso.notLoginView = () -> {
return new ModelAndView("sa-login.html");
});
};
// 配置:登录处理函数
sso.setDoLoginHandle((name, pwd) -> {
sso.doLoginHandle = (name, pwd) -> {
// 此处仅做模拟登录,真实环境应该查询数据进行登录
if("sa".equals(name) && "123456".equals(pwd)) {
StpUtil.login(10001);
return SaResult.ok("登录成功!").setData(StpUtil.getTokenValue());
}
return SaResult.error("登录失败!");
});
};
// 配置 Http 请求处理器 (在模式三的单点注销功能下用到,如不需要可以注释掉)
sso.setSendHttp(url -> {
sso.sendHttp = url -> {
try {
// 发起 http 请求
System.out.println("------ 发起请求:" + url);
@@ -54,6 +54,6 @@ public class SsoConfig {
e.printStackTrace();
return null;
}
});
};
}
}

View File

@@ -14,9 +14,9 @@ public class SsoConfig {
@Bean
private void configSso(SaSsoConfig sso) {
// 配置Http请求处理器
sso.setSendHttp(url -> {
sso.sendHttp = url -> {
System.out.println("------ 发起请求:" + url);
return Forest.get(url).executeAsString();
});
};
}
}

View File

@@ -37,22 +37,22 @@ public class SsoServerController {
private void configSso(SaSsoConfig sso) {
// 配置未登录时返回的View
sso.setNotLoginView(() -> {
sso.notLoginView = () -> {
return new ModelAndView("sa-login.html");
});
};
// 配置:登录处理函数
sso.setDoLoginHandle((name, pwd) -> {
sso.doLoginHandle = (name, pwd) -> {
// 此处仅做模拟登录,真实环境应该查询数据进行登录
if("sa".equals(name) && "123456".equals(pwd)) {
StpUtil.login(10001);
return SaResult.ok("登录成功!").setData(StpUtil.getTokenValue());
}
return SaResult.error("登录失败!");
});
};
// 配置 Http 请求处理器 (在模式三的单点注销功能下用到,如不需要可以注释掉)
sso.setSendHttp(url -> {
sso.sendHttp = url -> {
try {
// 发起 http 请求
System.out.println("------ 发起请求:" + url);
@@ -61,7 +61,7 @@ public class SsoServerController {
e.printStackTrace();
return null;
}
});
};
}
// 示例:获取数据接口(用于在模式三下,为 client 端开放拉取数据的接口)

View File

@@ -46,10 +46,10 @@ public class SsoClientController {
@Autowired
private void configSso(SaSsoConfig sso) {
// 配置Http请求处理器
sso.setSendHttp(url -> {
sso.sendHttp = url -> {
System.out.println("------ 发起请求:" + url);
return Forest.get(url).executeAsString();
});
};
}
// 查询我的账号信息