Show / Hide Table of Contents

    Class AuthenticationUtility

    Provides a set of generic ways to work with HTTP based authentication.

    Inheritance
    System.Object
    AuthenticationUtility
    Namespace: Cuemon.AspNetCore.Authentication
    Assembly: Cuemon.AspNetCore.Authentication.dll
    Syntax
    public static class AuthenticationUtility

    Fields

    | Improve this Doc

    BasicAuthenticationCredentialSeparator

    The value of the header credential separator of a HTTP Basic access authentication.

    Declaration
    public const char BasicAuthenticationCredentialSeparator = ':'
    Field Value
    Type Description
    System.Char
    | Improve this Doc

    DigestAuthenticationCredentialSeparator

    The value of the header credential separator of a HTTP Digest access authentication.

    Declaration
    public const char DigestAuthenticationCredentialSeparator = ','
    Field Value
    Type Description
    System.Char
    | Improve this Doc

    HttpNotAuthorizedStatus

    The value of the status description associated with HttpNotAuthorizedStatusCode.

    Declaration
    public const string HttpNotAuthorizedStatus = "401 Unauthorized"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    HttpNotAuthorizedStatusCode

    Equivalent to HTTP status 401. Unauthorized indicates that the requested resource requires authentication.

    Declaration
    public const int HttpNotAuthorizedStatusCode = 401
    Field Value
    Type Description
    System.Int32
    | Improve this Doc

    JwtAuthenticationCredentialSeparator

    The value of the header credential separator of a HTTP JSON Web Token authentication.

    Declaration
    public const char JwtAuthenticationCredentialSeparator = '.'
    Field Value
    Type Description
    System.Char

    Methods

    | Improve this Doc

    Authenticate<T>(HttpContext, Boolean, Func<HttpContext, String, T>, TesterFunc<HttpContext, T, ClaimsPrincipal, Boolean>)

    Provides a generic way to make authentication requests using the specified context.

    Declaration
    public static void Authenticate<T>(HttpContext context, bool requireSecureConnection, Func<HttpContext, string, T> authorizationParser, TesterFunc<HttpContext, T, ClaimsPrincipal, bool> principalParser)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Http.HttpContext context

    The context of the ASP.NET application.

    System.Boolean requireSecureConnection

    When true, the HTTP connection is required to use secure sockets (that is, HTTPS); when false no requirement is enforced.

    System.Func<Microsoft.AspNetCore.Http.HttpContext, System.String, T> authorizationParser

    The function delegate that will parse the authorization header of a web request and return the credentials of T.

    TesterFunc<Microsoft.AspNetCore.Http.HttpContext, T, System.Security.Claims.ClaimsPrincipal, System.Boolean> principalParser

    The function delegate that will parse the credentials of T returned from authorizationParser and if successful returns a System.Security.Claims.ClaimsPrincipal object.

    Type Parameters
    Name Description
    T

    The type of the credentials returned from authorizationParser and passed to principalParser.

    Exceptions
    Type Condition
    System.Security.SecurityException

    Authorized failed for the request.

    | Improve this Doc

    TryAuthenticate<T>(HttpContext, Boolean, Func<HttpContext, String, T>, TesterFunc<HttpContext, T, ClaimsPrincipal, Boolean>)

    Provides a generic way to make authentication requests using the specified context.

    Declaration
    public static bool TryAuthenticate<T>(HttpContext context, bool requireSecureConnection, Func<HttpContext, string, T> authorizationParser, TesterFunc<HttpContext, T, ClaimsPrincipal, bool> principalParser)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Http.HttpContext context

    The context of the ASP.NET application.

    System.Boolean requireSecureConnection

    When true, the HTTP connection is required to use secure sockets (that is, HTTPS); when false no requirement is enforced.

    System.Func<Microsoft.AspNetCore.Http.HttpContext, System.String, T> authorizationParser

    The function delegate that will parse the authorization header of a web request and return the credentials of T.

    TesterFunc<Microsoft.AspNetCore.Http.HttpContext, T, System.Security.Claims.ClaimsPrincipal, System.Boolean> principalParser

    The function delegate that will parse the credentials of T returned from authorizationParser and if successful returns a System.Security.Claims.ClaimsPrincipal object.

    Returns
    Type Description
    System.Boolean

    true if the specified parameters triggers a successful authentication; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of the credentials returned from authorizationParser and passed to principalParser.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX