11 Commits

Author SHA1 Message Date
JEECG
b296c8f6d5 3.7.0里程碑版本发布(合并springboot3 sas分支) 2024-06-22 19:31:55 +08:00
JEECG
feb04114ef Merge pull request #1269 from EightMonth/sas
sas兼容shiro处理
2024-06-20 16:09:05 +08:00
EightMonth
74c955924f sas兼容shiro处理 2024-05-23 10:49:37 +08:00
EightMonth
37a2093a87 sas兼容shiro处理 2024-05-22 18:43:06 +08:00
JEECG
21e156278f Merge pull request #1016 from EightMonth/sas
基于sas打通三方登录
2024-01-17 13:56:40 +08:00
EightMonth
59fb423d36 打通三方登录 2024-01-16 19:50:33 +08:00
JEECG
10cfcd42c9 Merge pull request #998 from EightMonth/sas
切换为spring authorization server 登录,对应jeecg-boot springboot3_sas分支
2024-01-12 09:43:22 +08:00
EightMonth
52534d92c2 Merge branch 'master' into sas 2024-01-12 09:38:58 +08:00
EightMonth
4ed8270e7d 修改手机登录接口 2024-01-12 09:28:12 +08:00
JEECG
27239be92c Merge pull request #975 from EightMonth/sas
sas认证升级
2024-01-07 22:56:06 +08:00
EightMonth
0ff3188e5f sas认证升级 2024-01-04 11:06:52 +08:00
5 changed files with 31 additions and 9 deletions

View File

@@ -4,11 +4,13 @@
export interface LoginParams {
username: string;
password: string;
grant_type: string;
}
export interface ThirdLoginParams {
token: string;
thirdType: string;
grant_type: string;
}
export interface RoleInfo {

View File

@@ -13,7 +13,7 @@ import { ExceptionEnum } from "@/enums/exceptionEnum";
const { createErrorModal } = useMessage();
enum Api {
Login = '/sys/login',
phoneLogin = '/sys/phoneLogin',
phoneLogin = '/oauth2/token',
Logout = '/sys/logout',
GetUserInfo = '/sys/user/getUserInfo',
// 获取系统权限
@@ -36,7 +36,7 @@ enum Api {
//修改密码
passwordChange = '/sys/user/passwordChange',
//第三方登录
thirdLogin = '/sys/thirdLogin/getLoginUser',
thirdLogin = '/oauth2/token',
//第三方登录
getThirdCaptcha = '/sys/thirdSms',
//获取二维码信息
@@ -53,6 +53,10 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal')
{
url: Api.Login,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic amVlY2ctY2xpZW50OnNlY3JldA=='
},
},
{
errorMessageMode: mode,
@@ -68,8 +72,13 @@ export function phoneLoginApi(params: LoginParams, mode: ErrorMessageMode = 'mod
{
url: Api.phoneLogin,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic amVlY2ctY2xpZW50OnNlY3JldA=='
},
},
{
isTransformResponse: false,
errorMessageMode: mode,
}
);
@@ -171,12 +180,19 @@ export function thirdLogin(params, mode: ErrorMessageMode = 'modal') {
tenantId = params.tenantId;
}
//==========end 第三方登录/auth2登录需要传递租户id===========
return defHttp.get<LoginResultModel>(
return defHttp.post<LoginResultModel>(
{
url: `${Api.thirdLogin}/${params.token}/${params.thirdType}/${tenantId}`,
url: `${Api.thirdLogin}`,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic amVlY2ctY2xpZW50OnNlY3JldA=='
},
},
{
isTransformResponse: false,
errorMessageMode: mode,
}
);
}

View File

@@ -151,6 +151,7 @@ export const useUserStore = defineStore({
): Promise<GetUserInfoModel | null> {
try {
const { goHome = true, mode, ...loginParams } = params;
loginParams.grant_type = 'password';
const data = await loginApi(loginParams, mode);
const { token, userInfo } = data;
// save token
@@ -248,10 +249,11 @@ export const useUserStore = defineStore({
): Promise<GetUserInfoModel | null> {
try {
const { goHome = true, mode, ...loginParams } = params;
loginParams.grant_type = 'phone';
const data = await phoneLoginApi(loginParams, mode);
const { token } = data;
const { access_token } = data;
// save token
this.setToken(token);
this.setToken(access_token);
return this.afterLoginAction(goHome, data);
} catch (error) {
return Promise.reject(error);
@@ -356,10 +358,11 @@ export const useUserStore = defineStore({
): Promise<any | null> {
try {
const { goHome = true, mode, ...ThirdLoginParams } = params;
ThirdLoginParams.grant_type = "social";
const data = await thirdLogin(ThirdLoginParams, mode);
const { token } = data;
const { access_token } = data;
// save token
this.setToken(token);
this.setToken(access_token);
return this.afterLoginAction(goHome, data);
} catch (error) {
return Promise.reject(error);

View File

@@ -165,7 +165,7 @@ const transform: AxiosTransform = {
// update-end--author:liaozhiyang---date:20240509---for【issues/1220】登录时vue3版本不加载字典数据设置无效
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
// jwt token
config.headers.Authorization = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : token;
config.headers.Authorization = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : 'Bearer ' + token;
config.headers[ConfigEnum.TOKEN] = token;
// 将签名和时间戳,添加在请求接口 Header

View File

@@ -149,6 +149,7 @@
username: data.account,
captcha: data.inputCode,
checkKey: randCodeData.checkKey,
grant_type: 'password',
mode: 'none', //不要默认的错误提示
})
);