Table of Contents

TBasicAuthMiddleware Class

HTTP server middleware that authenticates requests using the HTTP Basic authentication scheme.

Remarks

The middleware reads the Authorization header, decodes the Base64 user name and password, and calls the OnAuthenticate callback to validate the credentials. If a valid IUserIdentity is returned it is assigned to the request user. When a downstream handler responds with status 401, the middleware adds a WWW-Authenticate challenge header using the configured Realm.

Syntax

Unit: Sparkle.Middleware.BasicAuth

TBasicAuthMiddleware = class(THttpServerMiddleware, IBasicAuthMiddleware);

Constructors

Properties

Name Description
OnAuthenticate The callback invoked to authenticate each request from its Basic credentials.
Realm Gets or sets the realm reported in the WWW-Authenticate challenge header sent with 401 responses.