裁判账号 JWT 有效期调整为 24 小时。
This commit is contained in:
parent
1c9f773556
commit
c3a531c4ee
@ -18,6 +18,9 @@ public class OAuthController : IDynamicApiController
|
||||
private readonly ILogger<OAuthController> _logger;
|
||||
|
||||
private const string SmsCodeCachePrefix = "sms:code:";
|
||||
private const long RefereeAccessTokenExpiredMinutes = 24 * 60;
|
||||
private const int DefaultAccessTokenExpiresInSeconds = 2 * 60 * 60;
|
||||
private const int RefereeAccessTokenExpiresInSeconds = 24 * 60 * 60;
|
||||
|
||||
public OAuthController(
|
||||
ISqlSugarRepository<YD_Event.Core.Entities.AppUser> appUserRepository,
|
||||
@ -120,7 +123,9 @@ public class OAuthController : IDynamicApiController
|
||||
{
|
||||
AccessToken = accessToken,
|
||||
RefreshToken = refreshToken,
|
||||
ExpiresIn = 7200,
|
||||
ExpiresIn = appUser.MiniProgramRole == MiniProgramRole.Referee
|
||||
? RefereeAccessTokenExpiresInSeconds
|
||||
: DefaultAccessTokenExpiresInSeconds,
|
||||
UserInfo = userInfo
|
||||
};
|
||||
}
|
||||
@ -300,13 +305,16 @@ public class OAuthController : IDynamicApiController
|
||||
private (string AccessToken, string RefreshToken) GenerateTokens(YD_Event.Core.Entities.AppUser appUser)
|
||||
{
|
||||
long uniqueId = _idGenerator.NewLong();
|
||||
long? accessTokenExpiredMinutes = appUser.MiniProgramRole == MiniProgramRole.Referee
|
||||
? RefereeAccessTokenExpiredMinutes
|
||||
: null;
|
||||
string accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>()
|
||||
{
|
||||
[AuthClaimsConst.AuthIdKey] = appUser.Id,
|
||||
[AuthClaimsConst.AccountKey] = appUser.Mobile,
|
||||
[AuthClaimsConst.UuidKey] = uniqueId,
|
||||
[AuthClaimsConst.AuthPlatformTypeKey] = AuthPlatformType.WeChatApplet
|
||||
});
|
||||
}, accessTokenExpiredMinutes);
|
||||
|
||||
string refreshToken = JWTEncryption.GenerateRefreshToken(accessToken);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user