Method KeyFor
- Namespace
- MailFathom.Infrastructure.Security.Transport
- Assembly
- MailFathom.Infrastructure.dll
KeyFor(string, string?, string?)
Names the partition a request's capacity is taken from.
public static string KeyFor(string surfaceName, string? authenticatedClientName, string? matchedCertificateProfileName)
Parameters
surfaceNamestringThe name of the transport surface the request arrived on.
authenticatedClientNamestringThe name of the credential the request authenticated with, or null when it authenticated with none.
matchedCertificateProfileNamestringThe name of the trust profile the connection certificate matched, or null when no certificate identified a client application.
Returns
- string
The surface's name, followed by the configured name of the authenticated client, a partition of the identified client application, or AnonymousIdentity.
Remarks
Both identity names are MailFathom's own configured identities, never a credential and never anything a certificate carried. They are chosen by the operator who wrote the configuration, so the partitions an identified surface keeps number no more than its key list plus its profile list. A blank name is treated as no name at all rather than as a partition of its own.
A profile's partition is bracketed and a key's is not, because the two grammars are the same — both accept
letters, digits, dots, dashes, and underscores — so a profile and a key sharing a name would otherwise share a
bucket. Under ApiKey both kinds occur at once, since a request whose credential was refused still reaches
this with the profile its certificate matched.
Exceptions
- ArgumentException
Thrown when
surfaceNameis null, empty, or white space.