Share via


ConfigurationManager<T>.GetConfigurationAsync Method

Definition

Overloads

GetConfigurationAsync()

Obtains an updated version of Configuration.

GetConfigurationAsync(CancellationToken)

Obtains an updated version of Configuration.

GetConfigurationAsync()

Obtains an updated version of Configuration.

public System.Threading.Tasks.Task<T> GetConfigurationAsync();
member this.GetConfigurationAsync : unit -> System.Threading.Tasks.Task<'T (requires 'T : null)>
Public Function GetConfigurationAsync () As Task(Of T)

Returns

Task<T>

Configuration of type T.

Exceptions

Throw if the configuration is unable to be retrieved.

Throw if the configuration fails to be validated by the IConfigurationValidator<T>.

Remarks

If the time since the last call is less than AutomaticRefreshInterval then GetConfigurationAsync(String, IDocumentRetriever, CancellationToken) is not called and the current Configuration is returned.

Applies to

GetConfigurationAsync(CancellationToken)

Obtains an updated version of Configuration.

public virtual System.Threading.Tasks.Task<T> GetConfigurationAsync(System.Threading.CancellationToken cancel);
abstract member GetConfigurationAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T (requires 'T : null)>
override this.GetConfigurationAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T (requires 'T : null)>
Public Overridable Function GetConfigurationAsync (cancel As CancellationToken) As Task(Of T)

Parameters

cancel
CancellationToken

CancellationToken

Returns

Task<T>

Configuration of type T.

Implements

Exceptions

Throw if the configuration is unable to be retrieved.

Throw if the configuration fails to be validated by the IConfigurationValidator<T>.

Remarks

If the time since the last call is less than AutomaticRefreshInterval then GetConfigurationAsync(String, IDocumentRetriever, CancellationToken) is not called and the current Configuration is returned. By default, this method blocks until the configuration is retrieved the first time. After the configuration was retrieved once, updates will happen in the background. Failures to retrieve the configuration on the background thread will be logged.

If this operation is configured to be blocking through the switch 'Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking' then this method will block each time the configuration needs to be updated or hasn't been retrieved. If the configuration cannot be initially retrieved an exception will be thrown. If the configuration has been retrieved, but cannot be updated, then the exception will be logged and the current configuration will be returned.

By using the app context switch you choose what works best for you when there is a signing key update: either block requests from being validated until the new key is retrieved, or allow requests to be validated with the current key until the new key is retrieved. If blocking, a service receiving high concurrent request may experience thread starvation.

Applies to