IConfidentialClientApplication Interface
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.
Represents confidential client applications - web apps, web APIs, daemon applications.
public interface IConfidentialClientApplication : Microsoft.Identity.Client.IClientApplicationBase
type IConfidentialClientApplication = interface
interface IClientApplicationBase
interface IApplicationBase
Public Interface IConfidentialClientApplication
Implements IClientApplicationBase
- Derived
- Implements
Remarks
Confidential client applications are typically applications which run on servers (web apps, web API, or even service/daemon applications). They are considered difficult to access, and therefore capable of keeping an application secret (hold configuration time secrets as these values would be difficult for end users to extract). A web app is the most common confidential client. The client ID is exposed through the web browser, but the secret is passed only in the back channel and never directly exposed. For details, see Client Applications.
Properties
AppConfig |
Details on the configuration of the ClientApplication for debugging purposes. (Inherited from IClientApplicationBase) |
AppTokenCache |
Application token cache which holds access tokens for this application. It's maintained and updated silently when calling AcquireTokenForClient(IEnumerable<String>) |
Authority |
Gets the URL of the authority, or the security token service (STS) from which MSAL.NET will acquire security tokens.
The return value of this property is either the value provided by the developer in the constructor of the application, or otherwise
the value of the Microsoft.Identity.Client.ApplicationBase.DefaultAuthority static member (that is |
UserTokenCache |
User token cache which holds ID tokens, access tokens, and refresh tokens for accounts. It's used and updated silently if needed when calling AcquireTokenSilent(IEnumerable<String>, IAccount) It is updated by each acquire token method, with the exception of AcquireTokenForClient(IEnumerable<String>) which only uses the application cache (see AppTokenCache). (Inherited from IClientApplicationBase) |
Methods
AcquireTokenByAuthorizationCode(IEnumerable<String>, String) |
Acquires a token from the authority configured in the app using the authorization code previously received from the identity provider using the OAuth 2.0 authorization code flow. See Authorization Code Flow. This flow is usually used in web apps (for instance, ASP.NET and ASP.NET Core web apps) which sign-in users and can request an authorization code. This method does not look in the token cache, but stores the result in it. Before calling this method, use other methods such as AcquireTokenSilent(IEnumerable<String>, IAccount) to check the token cache. |
AcquireTokenForClient(IEnumerable<String>) |
Acquires a token from the authority configured in the app for the confidential client itself (not for a user) using the client credentials flow. See Client Credentials Flow. During this operation MSAL will first search in the cache for an unexpired token before acquiring a new one from Microsoft Entra ID. |
AcquireTokenOnBehalfOf(IEnumerable<String>, UserAssertion) |
Acquires an access token for this application (usually a web API) from the authority configured in the application, in order to access another downstream protected web API on behalf of a user using the OAuth 2.0 On-Behalf-Of flow. During this operation MSAL will first search in the cache for an unexpired token before acquiring a new one from Microsoft Entra ID. See On-Behalf-Of Flow. |
AcquireTokenSilent(IEnumerable<String>, IAccount) |
Attempts to acquire an access token for the |
AcquireTokenSilent(IEnumerable<String>, String) |
Obsolete.
In confidential client apps use AcquireTokenSilent(IEnumerable<String>, IAccount) instead. |
GetAccountAsync(String) |
Get the IAccount by its identifier among the accounts available in the token cache and of the same environment (authority host) as Authority. (Inherited from IClientApplicationBase) |
GetAccountsAsync() |
Obsolete.
Use GetAccountAsync(String) in web apps and web APIs, and use a token cache serializer for better security and performance. See https://aka.ms/msal-net-cca-token-cache-serialization. |
GetAccountsAsync(String) |
Only for Azure AD B2C scenarios, get the IAccount collection by its identifier among the accounts available in the token cache based on the user flow. (Inherited from IClientApplicationBase) |
GetAuthorizationRequestUrl(IEnumerable<String>) |
Computes the URL of the authorization request letting the user sign-in and consent to the application accessing specific scopes in the user's name. The URL targets the /authorize endpoint of the authority configured in the application. |
RemoveAsync(IAccount) |
Removes all tokens in the cache for the specified account. (Inherited from IClientApplicationBase) |
Extension Methods
GetCertificate(IConfidentialClientApplication) |
Returns the certificate used to create this ConfidentialClientApplication, if any. |