Class ProtoTestUserHeader

Namespace
ProtoTest.Http
Assembly
ProtoTest.Http.dll

The wire form the built-in test user travels in: one ProtoTest-User header (a gRPC call carries it as prototest-user metadata) holding the identity as Base64-encoded JSON. The header is not a credential - it only names a test identity - and the app reads it through the shipped in-process authentication; an application that does not register it ignores the header.

public static class ProtoTestUserHeader
Inheritance
ProtoTestUserHeader
Inherited Members

Fields

HeaderName

The request header that carries the identity.

public const string HeaderName = "ProtoTest-User"

Field Value

string

Methods

Encode(ProtoTestUser)

Encodes a user as the header value.

public static string Encode(ProtoTestUser user)

Parameters

user ProtoTestUser

Returns

string

TryDecode(string?, out ProtoTestUser?)

Decodes a header value, returning false when it carries no valid test user: a blank or oversized value, a value that is not Base64, a payload that is not a Json identity, or an identity whose name, roles or claims are malformed (a null or blank role element, a null claim, or a claim without a type or value).

public static bool TryDecode(string? headerValue, out ProtoTestUser? user)

Parameters

headerValue string
user ProtoTestUser

Returns

bool