Class BowireHttpAuth

Namespace
Kuestenlogik.Bowire.Auth
Assembly
Kuestenlogik.Bowire.dll

Negotiate / NTLM / Digest for every protocol that goes over HTTP (#679).

public static class BowireHttpAuth
Inheritance
BowireHttpAuth
Inherited Members

Remarks

The workbench sends the scheme and the resolved credentials as the MarkerKey metadata entry, the same way mTLS and SigV4 travel. A plugin hands its request and metadata to ApplyMetadata(HttpRequestMessage, IEnumerable<KeyValuePair<string, string>>?, Func<string, bool>?); the credentials ride on the request's options, and the client from BowireHttpClientFactory.Create answers the challenge with a handler kept per credential set. Connection-based schemes (NTLM, Negotiate) authenticate the TCP connection, so a connection authenticated as one user must never carry another user's request — hence one handler each.

.NET answers Negotiate and NTLM challenges itself. Digest it does too, but only qop=auth; BowireDigestHandler implements RFC 7616 in full, auth-int included.

Fields

MarkerKey

The metadata key the workbench, the CLI and MCP put the credentials under.

public const string MarkerKey = "__bowireHttpAuth__"

Field Value

string

OptionKey

public static readonly HttpRequestOptionsKey<BowireHttpAuthConfig> OptionKey

Field Value

HttpRequestOptionsKey<BowireHttpAuthConfig>

Properties

Capabilities

The schemes this host can use, for the workbench to offer.

public static IReadOnlyList<(string Id, bool Available, string? Reason)> Capabilities { get; }

Property Value

IReadOnlyList<(string Id, bool Available, string Reason)>

IntegratedAvailable

Whether Windows-integrated authentication (ambient credentials) can work here. Only a Windows host has a signed-in user's ticket to offer.

public static bool IntegratedAvailable { get; }

Property Value

bool

Methods

ApplyMetadata(HttpRequestMessage, IEnumerable<KeyValuePair<string, string>>?, Func<string, bool>?)

Put metadata on request: the real headers as headers, the credentials on the request's options. Bowire's internal markers never become headers. exclude names keys that are plugin settings rather than headers (SOAP's soap_action, for instance).

public static void ApplyMetadata(HttpRequestMessage request, IEnumerable<KeyValuePair<string, string>>? metadata, Func<string, bool>? exclude = null)

Parameters

request HttpRequestMessage
metadata IEnumerable<KeyValuePair<string, string>>
exclude Func<string, bool>

ApplyTo(HttpClientHandler, BowireHttpAuthConfig)

Set up handler to answer the challenge of config.

public static void ApplyTo(HttpClientHandler handler, BowireHttpAuthConfig config)

Parameters

handler HttpClientHandler
config BowireHttpAuthConfig

ApplyTo(ClientWebSocketOptions, BowireHttpAuthConfig)

Set up a WebSocket handshake to answer the challenge of config.

public static void ApplyTo(ClientWebSocketOptions options, BowireHttpAuthConfig config)

Parameters

options ClientWebSocketOptions
config BowireHttpAuthConfig

Remarks

Digest on a WebSocket upgrade goes through the platform, which supports qop=auth only.

Attach(HttpRequestMessage, IEnumerable<KeyValuePair<string, string>>?)

Carry what metadata asks of the HTTP layer on request: the challenge-response credentials, and the environment's cookie jar (#681). The factory's client acts on both.

public static void Attach(HttpRequestMessage request, IEnumerable<KeyValuePair<string, string>>? metadata)

Parameters

request HttpRequestMessage
metadata IEnumerable<KeyValuePair<string, string>>

Parse(string?)

Parse the marker's JSON value; null when it is not usable.

public static BowireHttpAuthConfig? Parse(string? json)

Parameters

json string

Returns

BowireHttpAuthConfig

TryParse(IEnumerable<KeyValuePair<string, string>>?)

The credentials in metadata, or null.

public static BowireHttpAuthConfig? TryParse(IEnumerable<KeyValuePair<string, string>>? metadata)

Parameters

metadata IEnumerable<KeyValuePair<string, string>>

Returns

BowireHttpAuthConfig

Wrap(HttpMessageHandler, BowireHttpAuthConfig)

inner wrapped for config: a Digest handler for Digest, the handler itself otherwise.

public static HttpMessageHandler Wrap(HttpMessageHandler inner, BowireHttpAuthConfig config)

Parameters

inner HttpMessageHandler
config BowireHttpAuthConfig

Returns

HttpMessageHandler