PhoneNumberTokenProvider Class

Summary

Represents a token provider that generates tokens from a user’s security stamp and sends them to the user via their phone number.

Syntax

public class PhoneNumberTokenProvider : TotpSecurityStampBasedTokenProvider, IUserTokenProvider

GitHub

View on GitHub

class Microsoft.AspNet.Identity.PhoneNumberTokenProvider

Constructors

PhoneNumberTokenProvider(IOptions<Microsoft.AspNet.Identity.PhoneNumberTokenProviderOptions>)

Creates a new instance of PhoneNumberTokenProvider&lt;TUser&gt; with the specified options.

Arguments:
  • options (IOptions{Microsoft.AspNet.Identity.PhoneNumberTokenProviderOptions}) – The options to use for the created instance of a PhoneNumberTokenProvider&lt;TUser&gt;.
public PhoneNumberTokenProvider(IOptions<PhoneNumberTokenProviderOptions> options)

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 as the user has a telephone number, otherwise false.

public override Task<bool> CanGenerateTwoFactorTokenAsync<TUser>(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 override Task<string> GetUserModifierAsync<TUser>(string purpose, UserManager<TUser> manager, TUser user)where TUser : class

Properties

Name()

Gets the name for this instance of PhoneNumberTokenProvider&lt;TUser&gt;.

Return type:System.String
public override string Name { get; }
Options()

Gets the options for this instance of PhoneNumberTokenProvider&lt;TUser&gt;.

Return type:Microsoft.AspNet.Identity.PhoneNumberTokenProviderOptions
public PhoneNumberTokenProviderOptions Options { get; }