Show / Hide Table of Contents

    Class UserInfoService<TIdentityUser>

    This service can be used in web applications that use Dangl.Identity for authentication ///

    Inheritance
    System.Object
    UserInfoService<TIdentityUser>
    Implements
    IUserInfoService
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Dangl.Identity.Client.Mvc.Services
    Assembly: Dangl.Identity.Client.Mvc.dll
    Syntax
    public class UserInfoService<TIdentityUser> : IUserInfoService where TIdentityUser : IdentityUser<Guid>, IDanglIdentityUser, new()
    Type Parameters
    Name Description
    TIdentityUser

    Constructors

    | Improve this Doc View Source

    UserInfoService(IHttpContextAccessor, UserManager<TIdentityUser>, IUserInfoUpdater)

    This services can be used in web applications that use Dangl.Identity for authentication ///

    Declaration
    public UserInfoService(IHttpContextAccessor httpContextAccessor, UserManager<TIdentityUser> userManager, IUserInfoUpdater userInfoUpdater)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor
    Microsoft.AspNetCore.Identity.UserManager<TIdentityUser> userManager
    IUserInfoUpdater userInfoUpdater

    Fields

    | Improve this Doc View Source

    CLIENT_CLAIM_PREFIX

    This is the prefix that is present on all client claims.

    Declaration
    public const string CLIENT_CLAIM_PREFIX = "client_"
    Field Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    ClientIsAuthenticatedAsync()

    Returns true if a client is authenticated. This is also true if a user is authenticated via a Jwt token generated for a client.

    Declaration
    public Task<bool> ClientIsAuthenticatedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>
    | Improve this Doc View Source

    GetClientClaimsAsync()

    This returns all claims prefixed with "client_" for the current principal.

    Declaration
    public Task<List<Claim>> GetClientClaimsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.Security.Claims.Claim>>
    | Improve this Doc View Source

    GetCurrentClientIdAsync()

    Returns the ClientId from the currently authenticated client

    Declaration
    public Task<string> GetCurrentClientIdAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>
    | Improve this Doc View Source

    GetCurrentUserEmailAsync()

    This relies on an actual user being authenticated. Will return null if no user is authenticated.

    Declaration
    public Task<string> GetCurrentUserEmailAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>
    | Improve this Doc View Source

    GetCurrentUserIdAsync()

    This relies on an actual user being authenticated. This will throw if no user is authenticated.

    Declaration
    public Task<Guid> GetCurrentUserIdAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Guid>
    | Improve this Doc View Source

    GetCurrentUserIdenticonIdAsync()

    This relies on an actual user being authenticated. This will throw if no user is authenticated.

    Declaration
    public Task<Guid> GetCurrentUserIdenticonIdAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Guid>
    | Improve this Doc View Source

    GetCurrentUserNameAsync()

    This relies on an actual user being authenticated. Will return null if no user is authenticated.

    Declaration
    public Task<string> GetCurrentUserNameAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>
    | Improve this Doc View Source

    GetUserClaimsAsync()

    Returns a list of all the user claims. This includes client claims that are prefixed with "client_".

    Declaration
    public Task<List<Claim>> GetUserClaimsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.Security.Claims.Claim>>
    | Improve this Doc View Source

    UserIsAuthenticatedAsync()

    Returns true if the current principal is a user. False if only a client is authenticated.

    Declaration
    public Task<bool> UserIsAuthenticatedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    Implements

    IUserInfoService

    Extension Methods

    ObjectExtensions.Clone<T>(T)
    • Improve this Doc
    • View Source
    Back to top © Dangl IT - Georg Dangl