Table of Contents

Method KeyFor

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

KeyFor(string, UserId?, string?, string?)

Names the partition a request's capacity is taken from.

public static string KeyFor(string surfaceName, UserId? authenticatedUser, string? authenticatedClientName, string? matchedCertificateProfileName)

Parameters

surfaceName string

The name of the transport surface the request arrived on.

authenticatedUser UserId?

The user the request's credential resolved to, or null when it authenticated with none or with one that names no user.

authenticatedClientName string

The name of the credential the request authenticated with, or null when it authenticated with none.

matchedCertificateProfileName string

The 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 authenticated user, the configured name of the authenticated client, a partition of the identified client application, or AnonymousIdentity.

Remarks

A user is MailFathom's own generated identity and each name is one of its configured identities — never a credential and never anything a certificate carried. The partitions an identified surface keeps therefore number no more than its roster plus its key list plus its profile list. A blank name, and a user naming nobody, are treated as no identity at all rather than as a partition of their own.

A user's and a profile's partitions are bracketed and a key's is not, because a key's grammar accepts letters, digits, dots, dashes, and underscores and so cannot spell either bracketed form — a profile and a key sharing a name would otherwise share a bucket. Under ApiKey a key and a profile occur at once, since a request whose credential was refused still reaches this with the profile its certificate matched.

Exceptions

ArgumentException

Thrown when surfaceName is null, empty, or white space.