Aracılığıyla paylaş


ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy Method

Definition

Create a new instance of the ApiKeyAuthenticationPolicy class, where the credential value will be specified in a request header.

public static System.ClientModel.Primitives.ApiKeyAuthenticationPolicy CreateHeaderApiKeyPolicy (System.ClientModel.ApiKeyCredential credential, string headerName, string? keyPrefix = default);
static member CreateHeaderApiKeyPolicy : System.ClientModel.ApiKeyCredential * string * string -> System.ClientModel.Primitives.ApiKeyAuthenticationPolicy
Public Shared Function CreateHeaderApiKeyPolicy (credential As ApiKeyCredential, headerName As String, Optional keyPrefix As String = Nothing) As ApiKeyAuthenticationPolicy

Parameters

credential
ApiKeyCredential

The ApiKeyCredential used to authenticate requests.

headerName
String

The name of the request header used to send the key credential in the request.

keyPrefix
String

A prefix to prepend before the key credential in the header value. If provided, the prefix string will be followed by a space and then the credential string. For example, setting valuePrefix to "SharedAccessKey" will result in the header value being set to "SharedAccessKey {credential.Key}".

Returns

Applies to