Table of Contents

Class TokenCacheKey

Namespace
Arc4u.OAuth2.Token
Assembly
Arc4u.OAuth2.dll

Builds the hashed part of a token cache key.

The token cache can be distributed (Redis, SQL Server) or persistent, so a key must be the same in every process and after a restart: GetHashCode() is randomized per process and must not be used. Secrets (passwords, client secrets, user tokens) must not appear in clear text in a key either, since keys are logged.

public static class TokenCacheKey
Inheritance
TokenCacheKey
Inherited Members

Methods

Hash(params string?[])

Returns the upper-case hexadecimal SHA-256 of parts. Each part is prefixed with its length so that different splits of the same characters ("ab","c" and "a","bc") give different hashes. A null part is hashed as an empty string.

public static string Hash(params string?[] parts)

Parameters

parts string[]

Every value that changes the token.

Returns

string

The hash, stable across processes and restarts.