Search Results for

    Show / Hide Table of Contents
    View Source

    Class BackOfficeExternalLoginService

    Provides functionality for managing external login providers and authentication for the back office.

    Inheritance
    object
    Namespace: Umbraco.Cms.Api.Management.Services
    Assembly: Umbraco.Cms.Api.Management.dll
    Syntax
    public class BackOfficeExternalLoginService : IBackOfficeExternalLoginService

    Constructors

    View Source

    BackOfficeExternalLoginService(IBackOfficeExternalLoginProviders, IUserService, IBackOfficeUserManager, IBackOfficeSignInManager, IMemoryCache)

    Initializes a new instance of the BackOfficeExternalLoginService class with the specified dependencies.

    Declaration
    public BackOfficeExternalLoginService(IBackOfficeExternalLoginProviders backOfficeExternalLoginProviders, IUserService userService, IBackOfficeUserManager backOfficeUserManager, IBackOfficeSignInManager backOfficeSignInManager, IMemoryCache memoryCache)
    Parameters
    Type Name Description
    IBackOfficeExternalLoginProviders backOfficeExternalLoginProviders

    Provides external login providers for back office authentication.

    IUserService userService

    Service for managing back office users.

    IBackOfficeUserManager backOfficeUserManager

    Manages back office user operations.

    IBackOfficeSignInManager backOfficeSignInManager

    Handles sign-in operations for back office users.

    IMemoryCache memoryCache

    The memory cache used for caching authentication data.

    Methods

    View Source

    ClaimsPrincipleFromLoginProviderLinkKeyAsync(string, Guid)

    Retrieves a System.Security.Claims.ClaimsPrincipal associated with the specified login provider and link key, if available.

    Declaration
    public Task<Attempt<ClaimsPrincipal?, ExternalLoginOperationStatus>> ClaimsPrincipleFromLoginProviderLinkKeyAsync(string loginProvider, Guid linkKey)
    Parameters
    Type Name Description
    string loginProvider

    The identifier of the external login provider.

    Guid linkKey

    The unique key used to locate the user link in the cache.

    Returns
    Type Description
    Task<Attempt<ClaimsPrincipal, ExternalLoginOperationStatus>>

    A System.Threading.Tasks.Task<TResult> that resolves to an Attempt<TResult, TStatus> containing the System.Security.Claims.ClaimsPrincipal if successful, or an ExternalLoginOperationStatus indicating the failure reason.

    View Source

    ExternalLoginStatusForUserAsync(Guid)

    Asynchronously retrieves the external login providers and their statuses for a specified user.

    Declaration
    public Task<Attempt<IEnumerable<UserExternalLoginProviderModel>, ExternalLoginOperationStatus>> ExternalLoginStatusForUserAsync(Guid userKey)
    Parameters
    Type Name Description
    Guid userKey

    The unique identifier (key) of the user whose external login status is to be retrieved.

    Returns
    Type Description
    Task<Attempt<IEnumerable<UserExternalLoginProviderModel>, ExternalLoginOperationStatus>>

    A System.Threading.Tasks.Task representing the asynchronous operation, containing an Attempt<IEnumerable<UserExternalLoginProviderModel>, ExternalLoginOperationStatus>. On success, the result contains a collection of UserExternalLoginProviderModel objects describing each available external login provider and whether the user is linked to it. On failure, the result contains an appropriate ExternalLoginOperationStatus error status.

    View Source

    GenerateLoginProviderSecretAsync(ClaimsPrincipal, string)

    Generates a secret for the specified external login provider based on the given claims principal.

    Declaration
    public Task<Attempt<Guid?, ExternalLoginOperationStatus>> GenerateLoginProviderSecretAsync(ClaimsPrincipal claimsPrincipal, string loginProvider)
    Parameters
    Type Name Description
    ClaimsPrincipal claimsPrincipal

    The claims principal representing the user.

    string loginProvider

    The external login provider identifier.

    Returns
    Type Description
    Task<Attempt<Guid?, ExternalLoginOperationStatus>>

    An Attempt containing the generated secret GUID if successful, or a failure status otherwise.

    View Source

    HandleLoginCallbackAsync(HttpContext)

    Handles the callback from an external login provider, attempting to link the external login to the currently authenticated back office user.

    Declaration
    public Task<Attempt<IEnumerable<IdentityError>, ExternalLoginOperationStatus>> HandleLoginCallbackAsync(HttpContext httpContext)
    Parameters
    Type Name Description
    HttpContext httpContext

    The current HTTP context containing authentication information from the external provider.

    Returns
    Type Description
    Task<Attempt<IEnumerable<IdentityError>, ExternalLoginOperationStatus>>

    A System.Threading.Tasks.Task representing the asynchronous operation. The result is an Attempt<TResult, TStatus> containing a collection of Microsoft.AspNetCore.Identity.IdentityError objects if the operation fails, and an ExternalLoginOperationStatus indicating the outcome (such as Success, Unauthorized, UserNotFound, ExternalInfoNotFound, or IdentityFailure).

    View Source

    UnLinkLoginAsync(ClaimsPrincipal, string, string)

    Asynchronously unlinks an external login from the specified back office user.

    Declaration
    public Task<Attempt<ExternalLoginOperationStatus>> UnLinkLoginAsync(ClaimsPrincipal claimsPrincipal, string loginProvider, string providerKey)
    Parameters
    Type Name Description
    ClaimsPrincipal claimsPrincipal

    The System.Security.Claims.ClaimsPrincipal representing the current authenticated user.

    string loginProvider

    The name of the external login provider to unlink (e.g., "Google", "AzureAD").

    string providerKey

    The unique key identifying the external login to be unlinked.

    Returns
    Type Description
    Task<Attempt<ExternalLoginOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult>, indicating whether the unlink operation succeeded and providing the status of the operation.

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