Class RegistrationTokens
Registration tokens: those in RegistrationTokens, which never run out, and those admins create in the database, with a number of uses and an expiry.
Inheritance
RegistrationTokens
Assembly: Uniform.Matrix.Server.dll
public sealed class RegistrationTokens
Constructors
|
Edit this page
View Source
RegistrationTokens(IDbContextFactory<ServerDbContext>, IOptionsMonitor<ServerOptions>, TimeProvider, ILogger<RegistrationTokens>)
Declaration
public RegistrationTokens(IDbContextFactory<ServerDbContext> contexts, IOptionsMonitor<ServerOptions> options, TimeProvider time, ILogger<RegistrationTokens> logger)
Parameters
Methods
|
Edit this page
View Source
Create a token: token, or a random one of length characters.
Declaration
public Task<RegistrationToken> CreateAsync(string? token, int length, int? usesAllowed, long? expiryTime, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Declaration
public Task DeleteAsync(string token, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the stored tokens; with valid, only those that may or may not register now.
Declaration
public Task<IReadOnlyList<RegistrationToken>> GetAllAsync(bool? valid, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return a stored token; throw M_NOT_FOUND when unknown.
Declaration
public Task<RegistrationToken> GetAsync(string token, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return whether token may register now: a configured one, or a stored one with uses left that has not expired.
Declaration
public Task<bool> IsValidAsync(string? token, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Change the uses or expiry of a token; a field not given stays as it is.
Declaration
public Task<RegistrationToken> UpdateAsync(string token, Optional<int?> usesAllowed, Optional<long?> expiryTime, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Use token for a registration; return false when it is not valid. Stored tokens count the use.
Declaration
public Task<bool> UseAsync(string? token, CancellationToken cancellationToken)
Parameters
Returns