Class AuthenticationMiddleware

Namespace
Cratis.Arc.Http
Assembly
Cratis.Arc.Core.dll

Middleware for authenticating HTTP requests.

public class AuthenticationMiddleware
Inheritance
AuthenticationMiddleware
Inherited Members
Extension Methods

Constructors

AuthenticationMiddleware(IAuthentication)

Middleware for authenticating HTTP requests.

public AuthenticationMiddleware(IAuthentication authentication)

Parameters

authentication IAuthentication

The authentication service.

Methods

Authenticate(IHttpRequestContext, EndpointMetadata?)

Handles authentication for the HTTP request.

public Task<bool> Authenticate(IHttpRequestContext context, EndpointMetadata? metadata)

Parameters

context IHttpRequestContext

The HTTP request context.

metadata EndpointMetadata

The endpoint metadata.

Returns

Task<bool>

True if the request is authenticated or allows anonymous access, false otherwise.

Exceptions

AuthenticationRequiredWithoutHandlers

Authentication is required but no handler is registered.