IUserTokenProvider Interface

Summary

Provides an abstraction for token generators.

Syntax

public interface IUserTokenProvider

GitHub

View on GitHub

interface Microsoft.AspNet.Identity.IUserTokenProvider

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.

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” />.

Task<string> GenerateAsync<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.

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
string Name { get; }