TotpSecurityStampBasedTokenProvider Class

Summary

Represents a token provider that generates time based codes using the user’s security stamp.

Syntax

public abstract class TotpSecurityStampBasedTokenProvider : IUserTokenProvider

GitHub

View on GitHub

class Microsoft.AspNet.Identity.TotpSecurityStampBasedTokenProvider

Methods

CanGenerateTwoFactorTokenAsync<TUser>(Microsoft.AspNet.Identity.UserManager<TUser>, TUser)

Returns a flag indicating whether the token provider can generate a token suitable for two factor authentication token for the specified ref.

Arguments:
  • manager (Microsoft.AspNet.Identity.UserManager{{TUser}}) – The Microsoft.AspNet.Identity.UserManager`1 that can be used to retrieve user properties.
  • user ({TUser}) – The user a token could be generated for.
Return type:

System.Threading.Tasks.Task{System.Boolean}

Returns:

The <see cref=”T:System.Threading.Tasks.Task” /> that represents the asynchronous operation, containing the a flag indicating if a two factor token could be generated by this provider for the specified <paramref name=”user” /> and <paramref name=”purpose” />. The task will return true if a two factor authentication token could be generated, otherwise false.

public abstract Task<bool> CanGenerateTwoFactorTokenAsync<TUser>(UserManager<TUser> manager, TUser user)where TUser : class
GenerateAsync<TUser>(System.String, Microsoft.AspNet.Identity.UserManager<TUser>, TUser)

Generates a token for the specified ref and purpose, as an asynchronous operation.

Arguments:
  • purpose (System.String) – The purpose the token will be used for.
  • manager (Microsoft.AspNet.Identity.UserManager{{TUser}}) – The Microsoft.AspNet.Identity.UserManager`1 that can be used to retrieve user properties.
  • user ({TUser}) – The user a token should be generated for.
Return type:

System.Threading.Tasks.Task{System.String}

Returns:

The <see cref=”T:System.Threading.Tasks.Task” /> that represents the asynchronous operation, containing the token for the specified

<paramref name=”user” /> and <paramref name=”purpose” />.

public virtual Task<string> GenerateAsync<TUser>(string purpose, UserManager<TUser> manager, TUser user)where TUser : class
GetUserModifierAsync<TUser>(System.String, Microsoft.AspNet.Identity.UserManager<TUser>, TUser)

Returns a constant, provider and user unique modifier used for entropy in generated tokens from user information, as an asynchronous operation.

Arguments:
  • purpose (System.String) – The purpose the token will be generated for.
  • manager (Microsoft.AspNet.Identity.UserManager{{TUser}}) – The Microsoft.AspNet.Identity.UserManager`1 that can be used to retrieve user properties.
  • user ({TUser}) – The user a token should be generated for.
Return type:

System.Threading.Tasks.Task{System.String}

Returns:

The <see cref=”T:System.Threading.Tasks.Task” /> that represents the asynchronous operation, containing a constant modifier for the specified

<paramref name=”user” /> and <paramref name=”purpose” />.

public virtual Task<string> GetUserModifierAsync<TUser>(string purpose, UserManager<TUser> manager, TUser user)where TUser : class
ValidateAsync<TUser>(System.String, System.String, Microsoft.AspNet.Identity.UserManager<TUser>, TUser)

Returns a flag indicating whether the specified token is valid for the given

user and purpose, as an asynchronous operation.

Arguments:
  • purpose (System.String) – The purpose the token will be used for.
  • token (System.String) – The token to validate.
  • manager (Microsoft.AspNet.Identity.UserManager{{TUser}}) – The Microsoft.AspNet.Identity.UserManager`1 that can be used to retrieve user properties.
  • user ({TUser}) – The user a token should be validated for.
Return type:

System.Threading.Tasks.Task{System.Boolean}

Returns:

The <see cref=”T:System.Threading.Tasks.Task” /> that represents the asynchronous operation, containing the a flag indicating the result of validating the <paramref name=”token”> for the specified </paramref> <paramref name=”user” /> and <paramref name=”purpose” />. The task will return true if the token is valid, otherwise false.

public virtual Task<bool> ValidateAsync<TUser>(string purpose, string token, UserManager<TUser> manager, TUser user)where TUser : class

Properties

Name()

Gets the name of the token provider.

Return type:System.String
public abstract string Name { get; }