GatekeeperBearerAuth

Classes > Nimblesite.Reporting.Api > GatekeeperBearerAuth

Validates Gatekeeper-issued HS256 bearer tokens locally, without a network call. Implements [REPORT-AUTH-BEARER].

public static class GatekeeperBearerAuth

Methods

ParseSigningKey(string?)

public static ImmutableArray<byte> ParseSigningKey(string? base64Key)

Reads the signing key from configuration. A missing or malformed key yields an empty key, which rejects every request (fail closed).

Parameters:

Name Type Description
base64Key String The configured base64 signing key, if any.

Returns: Byte> - The decoded key, or an empty array.

IsAuthorized(string?, ImmutableArray<byte>, DateTimeOffset)

public static bool IsAuthorized(string? authorizationHeader, ImmutableArray<byte> signingKey, DateTimeOffset now)

True when the Authorization header carries an unexpired token signed with the key.

Parameters:

Name Type Description
authorizationHeader String The raw Authorization header value.
signingKey Byte> The Gatekeeper HMAC-SHA256 signing key.
now DateTimeOffset The current time, used for the expiry check.

Returns: Boolean - Whether the request is authenticated.

Values

Name Description
SigningKeySetting Configuration key holding the base64 Gatekeeper signing key (same key Gatekeeper uses).