Table of Contents

Class AuthorizationHeaderOptions

Namespace
Cuemon.AspNetCore.Authentication
Assembly
Cuemon.AspNetCore.Authentication.dll

Configuration options for AuthorizationHeader.

public class AuthorizationHeaderOptions : IValidatableParameterObject, IParameterObject
Inheritance
AuthorizationHeaderOptions
Implements

Examples

The following example demonstrates how to customize the delimiters used when parsing authorization header credentials.

using System;
using Cuemon.AspNetCore.Authentication;

namespace MyApp.Examples;

public static class AuthorizationHeaderOptionsExample
{
    public static void Demonstrate()
    {
        var options = new AuthorizationHeaderOptions
        {
            CredentialsDelimiter = ", ",
            CredentialsKeyValueDelimiter = "="
        };

        options.ValidateOptions();

        Console.WriteLine(options.CredentialsDelimiter);
        Console.WriteLine(options.CredentialsKeyValueDelimiter);
    }
}

Constructors

AuthorizationHeaderOptions()

Initializes a new instance of the AuthorizationHeaderOptions class.

public AuthorizationHeaderOptions()

Remarks

The following table shows the initial property values for an instance of AuthorizationHeaderOptions.

PropertyInitial Value
CredentialsDelimiter,
CredentialsKeyValueDelimiter=

Properties

CredentialsDelimiter

Gets or sets the credentials delimiter.

public string CredentialsDelimiter { get; set; }

Property Value

string

The credentials delimiter.

CredentialsKeyValueDelimiter

Gets or sets the credentials key value delimiter.

public string CredentialsKeyValueDelimiter { get; set; }

Property Value

string

The credentials key value delimiter.

Methods

ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.

public void ValidateOptions()

Remarks

This method is expected to throw exceptions when one or more conditions fails to be in a valid state.

Exceptions

InvalidOperationException

CredentialsDelimiter cannot be null - or - CredentialsKeyValueDelimiter cannot be null.