ExAzureCore.Http.Plugins.SharedKey (ex_azure_core v0.3.0)

Copy Markdown

Req plugin that adds Azure Storage Shared Key authentication.

Implements the Shared Key authorization scheme for Azure Storage services. Builds a signature string from the request and signs it with HMAC-SHA256.

Supports both raw name/key options and AzureNamedKeyCredential structs.

Options

  • :account_name - Azure Storage account name
  • :account_key - Azure Storage account key, Base64-encoded
  • :named_key_credential - %AzureNamedKeyCredential{} (alternative to name/key)

Example

# Using raw options
req = Req.new()
|> ExAzureCore.Http.Plugins.SharedKey.attach(
  account_name: "myaccount",
  account_key: "base64key=="
)

# Using AzureNamedKeyCredential
{:ok, credential} = AzureNamedKeyCredential.new("myaccount", "base64key==")
req = Req.new()
|> ExAzureCore.Http.Plugins.SharedKey.attach(named_key_credential: credential)

Authorization Header Format

Authorization: SharedKey account:signature

Summary

Functions

Attaches the shared key plugin to a Req request.

Functions

attach(request, opts \\ [])

@spec attach(
  Req.Request.t(),
  keyword()
) :: Req.Request.t()

Attaches the shared key plugin to a Req request.