Search Results for

    Show / Hide Table of Contents
    View Source

    Class UmbTwoFactorLoginController

    Surface controller that handles two-factor authentication flows for members, including provider listing, code verification, and setup/disable operations.

    Inheritance
    object
    ControllerBase
    Controller
    PluginController
    SurfaceController
    Namespace: Umbraco.Cms.Web.Website.Controllers
    Assembly: Umbraco.Web.Website.dll
    Syntax
    [UmbracoMemberAuthorize]
    public class UmbTwoFactorLoginController : SurfaceController, IDiscoverable

    Constructors

    View Source

    UmbTwoFactorLoginController(ILogger<UmbTwoFactorLoginController>, IUmbracoContextAccessor, IUmbracoDatabaseFactory, ServiceContext, AppCaches, IProfilingLogger, IPublishedUrlProvider, IMemberSignInManager, IMemberManager, ITwoFactorLoginService)

    Initializes a new instance of the UmbTwoFactorLoginController class.

    Declaration
    public UmbTwoFactorLoginController(ILogger<UmbTwoFactorLoginController> logger, IUmbracoContextAccessor umbracoContextAccessor, IUmbracoDatabaseFactory databaseFactory, ServiceContext services, AppCaches appCaches, IProfilingLogger profilingLogger, IPublishedUrlProvider publishedUrlProvider, IMemberSignInManager memberSignInManager, IMemberManager memberManager, ITwoFactorLoginService twoFactorLoginService)
    Parameters
    Type Name Description
    ILogger<UmbTwoFactorLoginController> logger
    IUmbracoContextAccessor umbracoContextAccessor
    IUmbracoDatabaseFactory databaseFactory
    ServiceContext services
    AppCaches appCaches
    IProfilingLogger profilingLogger
    IPublishedUrlProvider publishedUrlProvider
    IMemberSignInManager memberSignInManager
    IMemberManager memberManager
    ITwoFactorLoginService twoFactorLoginService

    Methods

    View Source

    Disable(string, string?)

    Disables a two-factor provider for the currently authenticated member.

    Declaration
    [HttpPost]
    public Task<IActionResult> Disable(string providerName, string? returnUrl = null)
    Parameters
    Type Name Description
    string providerName

    The name of the two-factor provider to disable.

    string returnUrl

    Optional URL to redirect to on success.

    Returns
    Type Description
    Task<IActionResult>

    A redirect to the return URL on success; otherwise the current page.

    View Source

    Get2FAProviders()

    Retrieves the list of two-factor provider names valid for the member currently in the 2FA flow.

    Declaration
    [AllowAnonymous]
    public Task<ActionResult<IEnumerable<string>>> Get2FAProviders()
    Returns
    Type Description
    Task<ActionResult<IEnumerable<string>>>

    An Microsoft.AspNetCore.Mvc.ObjectResult containing the list of enabled provider names, or Microsoft.AspNetCore.Mvc.NotFoundResult when no member is in the 2FA flow.

    View Source

    ValidateAndSaveSetup(string, string, string, string?)

    Validates a two-factor setup code and, on success, persists the two-factor login for the currently authenticated member.

    Declaration
    [HttpPost]
    public Task<IActionResult> ValidateAndSaveSetup(string providerName, string secret, string code, string? returnUrl = null)
    Parameters
    Type Name Description
    string providerName

    The name of the two-factor provider being configured.

    string secret

    The shared secret generated during setup.

    string code

    The code the member has entered to verify the setup.

    string returnUrl

    Optional URL to redirect to on success.

    Returns
    Type Description
    Task<IActionResult>

    A redirect to the return URL on success; otherwise the current page with a validation error added to ModelState.

    View Source

    Verify2FACode(Verify2FACodeModel, string?)

    Verifies a two-factor authentication code for the member currently in the 2FA flow.

    Declaration
    [AllowAnonymous]
    public Task<IActionResult> Verify2FACode(Verify2FACodeModel model, string? returnUrl = null)
    Parameters
    Type Name Description
    Verify2FACodeModel model

    The submitted two-factor code and provider details.

    string returnUrl

    Optional URL to redirect to on successful verification.

    Returns
    Type Description
    Task<IActionResult>

    A redirect to the return URL on success; Microsoft.AspNetCore.Mvc.NotFoundResult when no member is in the 2FA flow; otherwise the current page with validation errors added to ModelState.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX