Я попытался установить свойство AccessTokenLifetime для моего неявного клиента на 90 секунд. Клиент - это приложение javascript.
Однако клиент все еще может получить доступ к области api «api1» в течение примерно 5 минут после истечения срока действия токена.
Это код для конфигурации клиента в IdentityServer4:
// JavaScript Client
new Client
{
ClientId = "js",
ClientName = "JavaScript Client",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RedirectUris = { "http://localhost:5003/callback.html" },
PostLogoutRedirectUris = { "http://localhost:5003/index.html" },
AllowedCorsOrigins = { "http://localhost:5003" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1"
},
AccessTokenLifetime = 90
}
Я использую решение для быстрого запуска Javascript из репозитория IdentityServer github здесь https://github.com/IdentityServer/IdentityServer4.Samples/tree/release/Quickstarts/7_JavaScriptClient