Skip to content

API Configuration Source

Tricklebyte edited this page Mar 15, 2020 · 38 revisions

IConfigurationBuilderExtensions.AddAPISource Method

Overloads

Method parameters routeParams or queryParams may be used to apply search parameters when calling the Configuration API GET Method. When an overload does not provide any search parameters, one route parameter will be added by default. The client assembly name will be used as the single route parameter.

AddApiSource (String, Boolean)

Authentication Types: Anonymous, Windows
Filter Type: Default Route Parameter (client assembly name)

Adds the ApiClient configuration source to the builder

public static IConfigurationBuilder AddApiSource(string configUrlVar, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String[],Boolean)

Authentication Types: Anonymous, Windows
Filter Type: Route Parameters

Adds the ApiClient configuration source to the builder

public static IConfigurationBuilder AddApiSource(string configUrlVar, string[] routeParams, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

routeParams String[]
Route parameter strings will be added to the Configuration URL when calling the API. Route Parameters will be added in the order that they appear in the array
Configuration URL/routeParams[0]/routeParams[1]/...

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, Dictionary<string,string>,Boolean)

Authentication Types: Anonymous, Windows
Filter Type: Query String Parameters

Adds the ApiClient configuration source to the builder

public static IConfigurationBuilder AddApiSource(string configUrlVar, Dictionary<string,string> queryParams, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

queryParams Dictionary<string,string>
Query parameter strings will be added to the Configuration URL when calling the API. Query Parameters will be added in the order that they appear in the Dictionary

BaseURL/?{key0}={value0}&{key1}={value1} etc...

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String, String, Boolean)

Authentication Types: ApiKey, Certificate
Filter Type: Default Route Parameter (client assembly name)

Adds the ApiClient configuration source to the builder

AddApiSource(string configUrlVar, string authType, string authSecretVar,  bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

authType String
Client authentication method (ApiKey, Certificate)

authSecret String
This will be the thumbprint when using Certificate Authentication, or the API Key when using APIKey Authentication.
When using Certificate Authentication, the thumbprint must match a locally installed Certificate in the Personal store.

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String, String, String[], Boolean)

Authentication Types: ApiKey, Certificate
Filter Type: Route Parameters

Adds the ApiClient configuration source to the builder

AddApiSource(string configUrlVar, string authType, string authSecretVar, string[] routeParams, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

authType String
Client authentication method (ApiKey, Certificate)

authSecret String
This will be the thumbprint when using Certificate Authentication, or the API Key when using APIKey Authentication.
When using Certificate Authentication, the thumbprint must match a locally installed Certificate in the Personal store.

routeParams String[]
Route parameter strings will be added to the Configuration URL when calling the API. Route Parameters will be added in the order that they appear in the Dictionary.
Configuration URL/routeParams[0]/routeParams[1]/...

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String, String, Dictionary<string,string>, Boolean)

Authentication Types: ApiKey, Certificate
Filter Type: Query String Parameters

Adds the ApiClient configuration source to the builder

AddApiSource(string configUrlVar, string authType, string authSecretVar, Dictionary<string,string> queryParams, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

authType String
Client authentication method (ApiKey, Certificate)

authSecret String
This will be the thumbprint when using Certificate Authentication, or the API Key when using APIKey Authentication.
When using Certificate Authentication, the thumbprint must match a locally installed Certificate in the Personal store.

queryParams Dictionary<string,string>
Query parameter strings will be added to the Configuration URL when calling the API. Query Parameters will be added in the order that they appear in the Dictionary

BaseURL/?{key0}={value0}&{key1}={value1} etc...

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String, String, String, Boolean)

Authentication Types: JwtBearer
Filter Type: Default Route Parameter (client assembly name)

Adds the ApiClient configuration source to the builder

AddApiSource(string configUrlVar, string authType, string jbAuthVar, string jbCientIdVar, string jbClientSecretVar, string jbClientScopeVar, string bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

authType String
Client authentication method (JwtBearer)

authorityVar String
Name of the Environment Variable containing the JwtBearer Authority URL.

clientIdVar String
Name of the Environment Variable containing the JwtBearer client id.

clientSecretVar String
Name of the Environment Variable containing the JwtBearer client secret.

clientScopeVar String
Name of the Environment Variable containing the JwtBearer client scope.

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String, String, String, String, String[], Boolean)

Authentication Types: JwtBearer
Filter Type: Route Parameters

Adds the ApiClient configuration source to the builder

AddApiSource(string configUrlVar, string authType, string authSecretVar, string[] routeParams, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

authType String
Client authentication method (JwtBearer)

authorityVar String
Name of the Environment Variable containing the JwtBearer Authority URL.

clientIdVar String
Name of the Environment Variable containing the JwtBearer client id.

clientSecretVar String
Name of the Environment Variable containing the JwtBearer client secret.

clientScopeVar String
Name of the Environment Variable containing the JwtBearer client scope.

routeParams String[]
Route parameter strings will be added to the Configuration URL when calling the API. Route Parameters will be added in the order that they appear in the array.
Configuration URL/routeParams[0]/routeParams[1]/...

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (String, String, String, String, String, Dictionary<string,string>, Boolean)

Authentication Types: JwtBearer
Filter Type: Query String Parameters

Adds the ApiClient configuration source to the builder

AddApiSource(string configUrlVar, string authType, string authSecretVar, Dictionary<string,string> queryParams, bool optional=false)

Parameters

configUrlVar String
Name of Environment Variable containing the URL of the configuration API, must include the full base address and method route without parameters.

authType String
Client authentication method (JwtBearer)

authorityVar String
Name of the Environment Variable containing the JwtBearer Authority URL.

clientIdVar String
Name of the Environment Variable containing the JwtBearer client id.

clientSecretVar String
Name of the Environment Variable containing the JwtBearer client secret.

clientScopeVar String
Name of the Environment Variable containing the JwtBearer client scope.

queryParams Dictionary<string,string>
Query parameter strings will be added to the Configuration URL when calling the API. Query Parameters will be added in the order that they appear in the Dictionary

BaseURL/?{key0}={value0}&{key1}={value1} etc...

optional Boolean
Whether the configuration source is optional. Default value is false


AddApiSource (IConfiguration, Boolean)

Authentication Types: All types
Filter Type: Route Parameters or Query String Parameters
Does not require host Environment Variables
Accepts IConfiguration which may be built using other configuration providers. This initial IConfiguration is passed into the AddApiSource method as a parameter when building the actual application configuration.\

public static IConfigurationBuilder AddApiSource(IConfiguration config, bool optional=false)

Parameters

config IConfiguration
IConfiguration built from other configuration providers.
Configuration Section ConfigOptions:ApiSource is required and allows configuration of all options.

optional Boolean
Whether the configuration source is optional. Default value is false

Configuration Section ConfigOptions:ApiSource

Example Authentication Type: JwtBearer
Example Fiter Type: Query String Parameters

{
  "ConfigOptions": {
    "ApiSource": {
      "AuthType": "JwtBearer",
      "Authority": "https://demo.identityserver.io",
      "Clientid": "m2m.short",
      "ClientSecret": "secret",
      "ClientScope": "api",
      "ConfigUrlKey": null,
      "ConfigUrl": "https://localhost:5009/iapi/ConfigSettings/",
      "RouteParams": null,
      "QueryParams": {
        "AppId": "testhost",
        "IdList": "1,3,5"
      }
    }
  }
}

Settings Descriptions


AuthType String - Client authentication method.
Acceptable Values: Anon, Windows, Certificate, ApiKey, JwtBearer

AuthSecret String (Used for AuthTypes Certificate and ApiKey only)
This will be the thumbprint when using Certificate Authentication, or the API Key when using APIKey Authentication.
When using Certificate Authentication, the thumbprint must match a locally installed Certificate in the Personal store.

Authority String (Used for AuthType JwtBearer only)
Url of IdentityServer

ClientId String (Used for AuthType JwtBearer only)
IdentityServer ClientId

ClientSecret String (Used for AuthType JwtBearer only)
IdentityServer Client Secret

ClientScope String (Used for AuthType JwtBearer only)
IdentityServer Client Scope

ConfigUrlKey String
Setting name that holds the base URL for the ConfigurationAPI
Defaults to ConfigOptions:ApiSource:ConfigUrl
May be used to override the default when the URL is stored elsewhere in the configuration.

ConfigUrl String
The URL of the configuration API action method. Must include the full base address and method route without parameters.

RouteParams String[]
Route Parameters will be added to the Configuration API URL in the order that they appear in the array. When no Route or Query String Parameters are specified, one default route parameter will be added with the value of the client assembly name.

QueryParams Dictionary<string,string>
Query parameter strings will be added to the Configuration URL when calling the API. Query Parameters will be added in the order that they appear in the Dictionary
BaseURL/?{key0}={value0}&{key1}={value1} etc...
NOTE: QueryParams will be ignored when RouteParams are present.

Refer to the Samples page for example Clients, APIs, and fully configured Solutions.

Clone this wiki locally