Class X509CertificateAuthenticationProvider
Authentication Provider based on the X.509 Certificate
public sealed class X509CertificateAuthenticationProvider : OAuthAuthenticationProvider, IAuthenticationProvider
- Inheritance
-
X509CertificateAuthenticationProvider
- Implements
- Inherited Members
Constructors
X509CertificateAuthenticationProvider(ILogger<OAuthAuthenticationProvider>, IMsalHttpClientFactory)
Public constructor leveraging DI to initialize the ILogger and IMsalHttpClientFactory interfaces
public X509CertificateAuthenticationProvider(ILogger<OAuthAuthenticationProvider> logger, IMsalHttpClientFactory msalHttpClientFactory)
Parameters
loggerILogger<OAuthAuthenticationProvider>The instance of the logger service provided by DI
msalHttpClientFactoryIMsalHttpClientFactoryThe instance of the Msal Http Client Factory service provided by DI
X509CertificateAuthenticationProvider(string, string, PnPCoreAuthenticationX509CertificateOptions)
Public constructor for external consumers of the library
public X509CertificateAuthenticationProvider(string clientId, string tenantId, PnPCoreAuthenticationX509CertificateOptions options)
Parameters
clientIdstringThe Client ID for the Authentication Provider
tenantIdstringThe Tenant ID for the Authentication Provider
optionsPnPCoreAuthenticationX509CertificateOptionsOptions for the authentication provider
X509CertificateAuthenticationProvider(string, string, StoreName, StoreLocation, string)
Public constructor for external consumers of the library
public X509CertificateAuthenticationProvider(string clientId, string tenantId, StoreName storeName, StoreLocation storeLocation, string thumbprint)
Parameters
clientIdstringThe Client ID for the Authentication Provider
tenantIdstringThe Tenant ID for the Authentication Provider
storeNameStoreNameThe Store Name to get the X.509 certificate from
storeLocationStoreLocationThe Store Location to get the X.509 certificate from
thumbprintstringThe Thumbprint of the X.509 certificate
X509CertificateAuthenticationProvider(string, string, X509Certificate2)
Public constructor for external consumers of the library
public X509CertificateAuthenticationProvider(string clientId, string tenantId, X509Certificate2 certificate)
Parameters
clientIdstringThe Client ID for the Authentication Provider
tenantIdstringThe Tenant ID for the Authentication Provider
certificateX509Certificate2The X.509 certificate to use for authentication
Properties
Certificate
The X.509 Certificate to use for app authentication
public X509Certificate2 Certificate { get; set; }
Property Value
Methods
AuthenticateRequestAsync(Uri, HttpRequestMessage)
Authenticates the specified request message.
public override Task AuthenticateRequestAsync(Uri resource, HttpRequestMessage request)
Parameters
resourceUriRequest uri
requestHttpRequestMessageThe HttpRequestMessage to authenticate.
Returns
- Task
The task to await.
GetAccessTokenAsync(Uri)
Gets an access token for the requested resource
public override Task<string> GetAccessTokenAsync(Uri resource)
Parameters
resourceUriResource to request an access token for
Returns
GetAccessTokenAsync(Uri, string[])
Gets an access token for the requested resource and scope
public override Task<string> GetAccessTokenAsync(Uri resource, string[] scopes)