CredentialResolver.TryResolve Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| TryResolve(IConfigurationSection, AuthenticationTokenProvider) |
Attempts to construct an AuthenticationTokenProvider for the supplied credential configuration section. |
| TryResolve(IConfigurationSection, Func<IConfigurationSection,AuthenticationTokenProvider>, AuthenticationTokenProvider) |
Attempts to construct an AuthenticationTokenProvider for the supplied credential configuration section, with access to a callback that recursively resolves child sections through the same active resolver chain. |
TryResolve(IConfigurationSection, AuthenticationTokenProvider)
- Source:
- CredentialResolver.cs
Attempts to construct an AuthenticationTokenProvider for the supplied credential configuration section.
public abstract bool TryResolve(Microsoft.Extensions.Configuration.IConfigurationSection credentialSection, out System.ClientModel.AuthenticationTokenProvider? provider);
abstract member TryResolve : Microsoft.Extensions.Configuration.IConfigurationSection * AuthenticationTokenProvider -> bool
Public MustOverride Function TryResolve (credentialSection As IConfigurationSection, ByRef provider As AuthenticationTokenProvider) As Boolean
Parameters
- credentialSection
- IConfigurationSection
The credential configuration section (post-overlay if any overrides were applied by the caller).
- provider
- AuthenticationTokenProvider
When this method returns true,
contains the constructed provider; otherwise null.
Returns
true if this resolver recognized and handled
the section; false to defer to the next resolver in the
chain.
Applies to
TryResolve(IConfigurationSection, Func<IConfigurationSection,AuthenticationTokenProvider>, AuthenticationTokenProvider)
- Source:
- CredentialResolver.cs
Attempts to construct an AuthenticationTokenProvider for the supplied credential configuration section, with access to a callback that recursively resolves child sections through the same active resolver chain.
public bool TryResolve(Microsoft.Extensions.Configuration.IConfigurationSection credentialSection, Func<Microsoft.Extensions.Configuration.IConfigurationSection,System.ClientModel.AuthenticationTokenProvider?> resolveChild, out System.ClientModel.AuthenticationTokenProvider? provider);
member this.TryResolve : Microsoft.Extensions.Configuration.IConfigurationSection * Func<Microsoft.Extensions.Configuration.IConfigurationSection, System.ClientModel.AuthenticationTokenProvider> * AuthenticationTokenProvider -> bool
Public Function TryResolve (credentialSection As IConfigurationSection, resolveChild As Func(Of IConfigurationSection, AuthenticationTokenProvider), ByRef provider As AuthenticationTokenProvider) As Boolean
Parameters
- credentialSection
- IConfigurationSection
The credential configuration section (post-overlay if any overrides were applied by the caller).
- resolveChild
- Func<IConfigurationSection,AuthenticationTokenProvider>
A callback that resolves a child
IConfigurationSection through the active resolver chain
(including caching, normalization, and ordering). Returns the resolved
AuthenticationTokenProvider, or null if
no resolver in the chain claims the child section. Always non-null;
resolvers that do not need the chain can ignore the callback.
Must only be invoked synchronously during this call; capturing the
callback and invoking it after TryResolve returns will throw
InvalidOperationException.
- provider
- AuthenticationTokenProvider
When this method returns true,
contains the constructed provider; otherwise null.
Returns
true if this resolver recognized and handled
the section; false to defer to the next resolver in the
chain.
Remarks
This overload exists so chain-owning resolvers (e.g., a resolver that builds a ChainedTokenCredential from child Sources[] entries) can recurse back into the active engine for each child entry without re-implementing the engine's caching, normalization, or ordering logic — and without requiring the resolver to know about credential sources owned by other packages. Subclasses override TryResolveCore(IConfigurationSection, Func<IConfigurationSection,AuthenticationTokenProvider>, AuthenticationTokenProvider) to participate; this method wraps resolveChild with a guard that enforces the synchronous-use contract and then forwards to TryResolveCore.