我想从ASP.Net扩展访问令牌的有效期。下面是App_Start \ Startup.Auth.cs
中的代码OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
//AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(364),
AllowInsecureHttp = true // In production mode set AllowInsecureHttp = false
};
但是,如果我将其部署到活动站点,该令牌将无法使用一年。我使用邮递员进行测试,设法获得了令牌,但是令牌将在20分钟后过期。
Providers / ApplicationOAuthProvider.cs
public ApplicationOAuthProvider(string publicClientId)
{
if (publicClientId == null)
{
throw new ArgumentNullException("publicClientId");
}
_publicClientId = publicClientId;
}
邮递员的结果
{
"access_token": "accesstoken",
"token_type": "bearer",
"expires_in": 86399,
"userName": "admin@admin",
".issued": "Thu, 11 Oct 2018 04:39:03 GMT",
".expires": "Fri, 12 Oct 2018 04:39:03 GMT"
}
我可以做些什么以ASP.Net MVC方式进行扩展吗?