我已经在系统中集成了身份服务器,现在我想保留身份服务器令牌,以便用户不必在浏览器关闭后重新登录。
这是我的代码。
//Identity server
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
IdentityServerRegistrar.Register(services, _appConfiguration);
//BHARAT : JWT Authentication Middleware
services.AddAuthentication().AddIdentityServerAuthentication("IdentityBearer", options =>
{
options.Authority = _appConfiguration["App:ServerRootAddress"];
options.RequireHttpsMetadata = false;
options.ApiName = "default-api";
options.ApiSecret = "def2edf7-5d42-4edc-a84a-30136c340e13".Sha256();
options.CacheDuration = TimeSpan.FromMinutes(30);
options.SaveToken = true;
});
}
我试图遵循此https://github.com/IdentityServer/IdentityServer3/issues/1379
这是浏览器中的令牌捕捉。
我尝试了许多其他方法来保存Cookie /令牌,但无法正常工作。
我是否需要在客户端添加任何内容,我使用的是带角度版本的.net core 2.0。
尝试更改login.service.ts中的条件:
// Before
var tokenExpireDate = rememberMe
? (new Date(new Date().getTime() + 1000 * expireInSeconds))
: undefined;
// After
var tokenExpireDate = expireInSeconds
? (new Date(new Date().getTime() + 1000 * expireInSeconds))
: undefined;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句