EmailTokenProvider Class

Summary

TokenProvider that generates tokens from the user’s security stamp and notifies a user via email.

Syntax

public class EmailTokenProvider : TotpSecurityStampBasedTokenProvider, IUserTokenProvider

GitHub

View on GitHub

class Microsoft.AspNet.Identity.EmailTokenProvider

Constructors

EmailTokenProvider(IOptions<Microsoft.AspNet.Identity.EmailTokenProviderOptions>, System.String)

Initializes a new instance of the EmailTokenProvider&lt;TUser&gt; class.

Arguments:
  • options (IOptions{Microsoft.AspNet.Identity.EmailTokenProviderOptions}) – The configured Microsoft.AspNet.Identity.DataProtectionTokenProviderOptions.
  • name (System.String) – The unique name for this instance of EmailTokenProvider&lt;TUser&gt;.
public EmailTokenProvider(IOptions<EmailTokenProviderOptions> options, string name = "")

Methods

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

Checks if a two factor authentication token can be generated for the specified user.

Arguments:
  • manager (Microsoft.AspNet.Identity.UserManager{{TUser}}) – The Microsoft.AspNet.Identity.UserManager`1 to retrieve the user from.
  • user ({TUser}) – The TUser to check for the possibility of generating a two factor authentication token.
Return type:

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

Returns:

True if the user has an email address set, 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 the a value for the user used as entropy in the generated token.

Arguments:
  • purpose (System.String) – The purpose of the two factor authentication token.
  • manager (Microsoft.AspNet.Identity.UserManager{{TUser}}) – The Microsoft.AspNet.Identity.UserManager`1 to retrieve the user from.
  • user ({TUser}) – The TUser to check for the possibility of generating a two factor authentication token.
Return type:

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

Returns:

A string suitable for use as entropy in token generation.

public override Task<string> GetUserModifierAsync<TUser>(string purpose, UserManager<TUser> manager, TUser user)where TUser : class

Properties

Name()

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

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

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

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