Class AuthAttribute<TAuthenticator>

Namespace
ProtoTest.Http
Assembly
ProtoTest.Http.dll

Applies an IProtoHttpAuthenticator to the HTTP-based clients of a test, for example [Auth<BearerTokenAuthenticator>("token")]. Several attributes at the same level are ordered by Order and composed.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class AuthAttribute<TAuthenticator> : Attribute, IProtoHttpAuthMetadata where TAuthenticator : class, IProtoHttpAuthenticator

Type Parameters

TAuthenticator
Inheritance
AuthAttribute<TAuthenticator>
Implements
Inherited Members
Extension Methods

Constructors

AuthAttribute(params object[])

Applies an IProtoHttpAuthenticator to the HTTP-based clients of a test, for example [Auth<BearerTokenAuthenticator>("token")]. Several attributes at the same level are ordered by Order and composed.

public AuthAttribute(params object[] constructorArgs)

Parameters

constructorArgs object[]

Properties

Order

public int Order { get; init; }

Property Value

int

Protocols

Restricts the authenticator to the named protocols, for example ["GraphQL"]. When empty the authenticator applies to every HTTP-based protocol the application exposes.

public string[] Protocols { get; init; }

Property Value

string[]

Methods

AppliesTo(string)

Returns whether this authenticator applies to the named protocol.

public bool AppliesTo(string protocolName)

Parameters

protocolName string

Returns

bool