Table of Contents

Class RestApiMetadataExtensions

Namespace
Songhay.Extensions
Assembly
SonghayCore.dll

Extensions of RestApiMetadata.

public static class RestApiMetadataExtensions
Inheritance
RestApiMetadataExtensions
Inherited Members

Methods

ToAzureActiveDirectoryAccessTokenData(RestApiMetadata?)

Converts the specified RestApiMetadata to the data required by GetAccessTokenAsync(Uri?, Dictionary<string, string>?).

public static Dictionary<string, string> ToAzureActiveDirectoryAccessTokenData(this RestApiMetadata? meta)

Parameters

meta RestApiMetadata

the RestApiMetadata

Returns

Dictionary<string, string>

Remarks

As of this writing, this member should return data of the form:

"grant_type": "client_credentials",
"scope": "https://vault.azure.net/.default",
"client_id": "active-directory-registration-app-id",
"client_secret": "active-directory-registration-app-secret"

where client_id is the value of the appId property in the output of az ad app list; client_secret is the secret exposed under the App registration in the Azure Portal.

🔬☔ test coverage of this member further documents how the RestApiMetadata should be formatted

ToAzureActiveDirectoryAccessTokenUri(RestApiMetadata?)

public static Uri ToAzureActiveDirectoryAccessTokenUri(this RestApiMetadata? meta)

Parameters

meta RestApiMetadata

the RestApiMetadata

Returns

Uri

Remarks

This member should return a Uri of the form:

https://login.microsoftonline.com/{tenantOrDirectoryId}/oauth2/v2.0/token

where tenantOrDirectoryId is the value of “Directory (tenant) ID” under the App registration in the Azure Portal.

🔬☔ test coverage of this member further documents how the RestApiMetadata should be formatted

ToAzureKeyVaultSecretUri(RestApiMetadata?, string)

Converts the specified RestApiMetadata to the Uri required by GetSecretAsync(string, Uri).

public static Uri ToAzureKeyVaultSecretUri(this RestApiMetadata? meta, string secretNameKey)

Parameters

meta RestApiMetadata

the RestApiMetadata

secretNameKey string

the name of the Claim key that returns the Vault secret

Returns

Uri

Remarks

This member should return a Uri of the form:

https://{vaultName}.vault.azure.net/secrets/{secretName}?api-version=2016-10-01

where vaultName is the name of the Azure Key Vault; secretName is the name of the secret in the vault.

🔬☔ test coverage of this member further documents how the RestApiMetadata should be formatted

ToUri(RestApiMetadata?, string?, params string?[])

Converts the specified RestApiMetadata to a Uri based on the specified URI Template.

public static Uri? ToUri(this RestApiMetadata? meta, string? uriTemplateKey, params string?[] bindByPositionValues)

Parameters

meta RestApiMetadata

the RestApiMetadata

uriTemplateKey string

The URI template key.

bindByPositionValues string[]

The bind by position values.

Returns

Uri