Skip to main content

Module matcher

Module matcher 

Source
Expand description

Tying the identity an authenticator obtained to an account in a directory.

An authenticator that has more than a name answers a [Lookup] with by: "claims" and its [Claims]. A Matcher holds ordered rules that turn claims into lookups of a [Directory], by a template: {san.upn}, {subject.cn|lower}, or an LDAP filter such as (userPrincipalName={san.upn}). The directory, never the credential, decides the account and its groups.

Rules are tried in order. A rule asks the directory for every candidate its template renders; if they name exactly one account that account is the match, if they name more than one the match is Match::Ambiguous and the walk ends, and if none the next rule is tried. A directory that cannot answer is an Err, never a fall-through. A rule may name a PinSource: the one account it found must then also hold one of the certificate’s pins there.

In a filter rule every value a claim puts into the template is escaped (RFC 4515, see escape_filter_value); the template’s own text is the filter’s structure. A claim with several values renders one candidate per value, at most MAX_CANDIDATES in all.

Structs§

MatchRule
One way to find the account: a template over the claims, and what it renders is.
Matched
A match and what to tell whoever runs the service about it.
Matcher
Ordered rules that tie claims to a directory account.
MatcherBuilder
Builds a Matcher and gives it the pin sources its rules name.
MatcherConfig
A matcher as plain data: ordered rules, default_rules when the key is absent.
MatcherError
An invalid rule. The message never quotes the template.

Enums§

Match
What a match came to.

Constants§

MAX_CANDIDATES
The most lookups one rule may render from the claims it is given.

Traits§

MatchRuleSetters
The typed setters of MatchRule, for any builder that holds its settings.
MatcherConfigSetters
The typed setters of MatcherConfig, for any builder that holds its settings.

Functions§

default_rules
The rules a matcher uses unless told otherwise: the UPN as a name, the email address as an email. The subject’s common name is not among them: it is whatever the issuer let the holder type, so a deployment that trusts it says so in a rule of its own.
escape_filter_value
Escapes value for the right-hand side of an LDAP filter assertion (RFC 4515): *, (, ), \ and NUL, every other control character, and every byte of a non-ASCII character, as \ and two lowercase hex digits. What is left is printable ASCII, so a value can never end an assertion, start another, or become a wildcard.