The main reason for my question is that I do .net core ABP's Token refresh function, according to the online article basically integrated into ABP, and when and how to store, always feel the system AbpUserTokens why not use tables come in, but also to find less than articles related presentations, so to issues questions, answers divided into three parts, a bit complicated, so I plan to make a copy, the following answer to the original
user token removal was implemented in #4441
By default, the worker run at an interval of 1 hours, you can configure it yourself. See https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers#user-token-removal-period
The user token should be generated by Microsoft.AspNetCore.Identity via IUserAuthenticatorKeyStoreinterface
translation:
1, the user token remove # 4441 implementation
2. By default, the worker process to run at 1 hour intervals, you can configure it yourself. See https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers#user-token-removal-period
3, should be changed by the user token in succession Microsoft.aspnetcore.identity IUserAuthenticatorKeyStore interface generation
- Make
RemoveTokenValidityKeyAsync
delete ALL keys from the same TokenValidityKeyProvider - Remove auto clean up when calling
IsTokenValidityKeyValidAsync
- Introduce
UserTokenExpirationWorker
periodic job (1 hour) that start inPostInitialize
ofAbpZeroCoreModlue
Introduce clean up methodRemoveTokenValidityKeysAsync
that delete ALL keys that are older than the givenexpireDateTime
Impact
ExpiredUser.Tokens
will no longer be removed automatically when callingIsTokenValidityKeyValidAsync
ExpiredUser.Tokens
can be removed by callingRemoveTokenValidityKeysAsync(user)
Use RemoveTokenValidityKeyAsync
to remove all the same key token from the TokenValidityKeyProvider
To remove the automatic cleanup, please call IsTokenValidityKeyValidAsync in AbpZeroCoreModlue of PostInitialize
the
Introducing removal method RemoveTokenValidityKeysAsync, which deletes all older than a given expiredatetime key ( why there is a strikeout, probably already expired)
influences
Expired user. No longer automatically deleted when invoking token IsTokenValidityKeyValidAsync
Expired user. You can delete the token by calling removetokenvaliditykeysasync (user)
The specific method in the source src / Abp.ZeroCore / Authorization / Users / AbpUserStore.cs
Part II: revision process interval
User token removal period
ABP Framework defines a background worker named UserTokenExpirationWorker which cleans the records in table AbpUserTokens. If you disable background job execution, this worker will not run. By default, UserTokenExpirationWorker runs every one hour. If you want to change this period, you can configure it like below:
Remove user token of
abp framework defines a process called UserTokenExpirationWorker of background work, it is clear the record of the table AbpUserTokens. If the background is disabled job execution, this work process will not run. By default, UserTokenExpirationWorker run once every hour. If you want to change this time period, can be configured as follows:
public class MyProjectWebModule : AbpModule { public override void PreInitialize() { Configuration.BackgroundJobs.CleanUserTokenPeriod = 1 * 60 * 60 * 1000; // 1 hour } //... }
3, how to generate the user token
IUserAuthenticatorKeyStore<TUser> Interface
It provides storage of user authentication information related to the abstract store.
His most important methods should be both, but why do I look ignorant to force it, but since the main points are mentioned, and the rest should be that of Baidu