|
|
|
@ -85,6 +85,12 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
|
|
|
|
|
throw Oops.Oh(ErrorCode.D1017);
|
|
|
|
|
//获取对应租户
|
|
|
|
|
var tenant = _sysTenantRep.Single(user.TenantId);
|
|
|
|
|
// 生成Token令牌
|
|
|
|
|
return await GetLoginToken(user, tenant);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task<string> GetLoginToken(SysUser user, SysTenant tenant)
|
|
|
|
|
{
|
|
|
|
|
// 生成Token令牌
|
|
|
|
|
//var accessToken = await _jwtBearerManager.CreateTokenAdmin(user);
|
|
|
|
|
var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>
|
|
|
|
@ -360,20 +366,8 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
|
|
|
|
|
throw Oops.Bah($"{showname}不存在,请先加入公司{comname}!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//var accessToken = JWTEncryption.Encrypt(dic);
|
|
|
|
|
|
|
|
|
|
//// 设置Swagger自动登录
|
|
|
|
|
//_httpContextAccessor.HttpContext.SigninToSwagger(accessToken);
|
|
|
|
|
|
|
|
|
|
//// 生成刷新Token令牌
|
|
|
|
|
//var refreshToken = JWTEncryption.GenerateRefreshToken(accessToken, 30);
|
|
|
|
|
|
|
|
|
|
//// 设置刷新Token令牌
|
|
|
|
|
//_httpContextAccessor.HttpContext.Response.Headers["x-access-token"] = refreshToken;
|
|
|
|
|
|
|
|
|
|
//return accessToken;
|
|
|
|
|
return await GetLoginToken(user, tenant);
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|