Table of Contents

Method TryNormalize

Namespace
MailFathom.Infrastructure.Security.Transport
Assembly
MailFathom.Infrastructure.dll

TryNormalize(string?, out string)

Normalizes a configured origin into the form a browser sends.

public static bool TryNormalize(string? configuredValue, out string normalizedOrigin)

Parameters

configuredValue string

The configured origin, for example https://client.example.test.

normalizedOrigin string

The serialized origin when the value is accepted; otherwise an empty string.

Returns

bool

true when the value is an origin this policy can compare against; otherwise false.

Remarks

A browser sends the serialized origin of RFC 6454: a lowercase scheme and host, and the port only when it is not the scheme's default. Configuration is normalized to that same form so a comparison is an equality test rather than a set of special cases, and so https://Client.Example.Test:443/ and https://client.example.test cannot be two different entries in one list. A path, a query, a fragment, or user information means the operator wrote a URL where an origin belongs, and is refused rather than silently discarded.