語言

DefaultCertificateLoader 類別

定義

憑證載入器。 只有在從守護程序或 ASP NET 應用程式直接使用 MSAL .NET 載入憑證時才使用。 對於 ASP NET Core 應用程式,Microsoft Identity Web 會幫你處理憑證載入。 <範例>

IConfidentialClientApplication app;
ICertificateLoader certificateLoader = new DefaultCertificateLoader();
    certificateLoader.LoadIfNeeded(config.CertificateDescription);

   app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
          .WithCertificate(config.CertificateDescription.Certificate)
          .WithAuthority(new Uri(config.Authority))
          .Build();
</範例>
public class DefaultCertificateLoader : Microsoft.Identity.Web.DefaultCredentialsLoader, Microsoft.Identity.Web.ICertificateLoader
type DefaultCertificateLoader = class
    inherit DefaultCredentialsLoader
    interface ICertificateLoader
Public Class DefaultCertificateLoader
Inherits DefaultCredentialsLoader
Implements ICertificateLoader
繼承
DefaultCertificateLoader
實作

建構函式

名稱 Description
DefaultCertificateLoader()

預設方案。

DefaultCertificateLoader(IEnumerable<ICredentialSourceLoader>, IEnumerable<ICustomSignedAssertionProvider>, ILogger<DefaultCertificateLoader>)

建構器同時具備自訂簽署斷言提供者與自訂憑證來源載入器。

DefaultCertificateLoader(IEnumerable<ICredentialSourceLoader>, ILogger<DefaultCertificateLoader>)

建構器搭配記錄器和自訂憑證來源載入器。

DefaultCertificateLoader(IEnumerable<ICustomSignedAssertionProvider>, ILogger<DefaultCertificateLoader>)

建構器搭配自訂簽署的斷言提供者。

DefaultCertificateLoader(ILogger<DefaultCertificateLoader>)

有建造機和伐木機。

屬性

名稱 Description
CredentialSourceLoaders

根據憑證來源的憑證載入器字典。 應用程式可以新增更多資料以處理更多憑證來源。

(繼承來源 DefaultCredentialsLoader)
CustomSignedAssertionCredentialSourceLoaders

自訂簽署斷言憑證來源載入器字典,依名稱(可 ICustomSignedAssertionProvider.Name 或完全限定型別名稱)。 應用程式可以新增更多資料以處理更多憑證來源。

(繼承來源 DefaultCredentialsLoader)
UserAssignedManagedIdentityClientId

這個預設值可以在憑證描述層級(針對 KeyVault 的憑證)覆蓋。

方法

名稱 Description
LoadAllCertificates(IEnumerable<CertificateDescription>)

從憑證描述清單載入所有憑證。

LoadCredentialsIfNeededAsync(CredentialDescription, CredentialSourceLoaderParameters)

如果需要,載入特定的憑證描述。 此方法將利用 來 CredentialSourceLoaders 載入描述中的憑證。

(繼承來源 DefaultCredentialsLoader)
LoadFirstCertificate(IEnumerable<CertificateDescription>)

從憑證描述清單載入第一個憑證。

LoadFirstCertificateAsync(IEnumerable<CertificateDescription>)

從憑證描述清單載入第一個憑證。

LoadFirstValidCredentialsAsync(IEnumerable<CredentialDescription>, CredentialSourceLoaderParameters)

從憑證描述清單載入第一個有效的憑證。 這在有多個部署時非常有用(例如在你的開發者機器上,你可以使用 KeyVault 的憑證,部署在 AKS 時則使用 AKS 的工作負載身份聯合。 你可以在 appsettings.json 檔案中表達憑證清單,這個方法會根據順序載入最合適的。

(繼承來源 DefaultCredentialsLoader)
LoadIfNeeded(CertificateDescription)

如果需要,請從描述中載入憑證。

LoadIfNeededAsync(CertificateDescription)

如果需要,請從描述中載入憑證。

ResetCertificates(IEnumerable<CertificateDescription>)

重設憑證描述清單中的所有憑證。 例如,在重試前使用。

ResetCertificates(IEnumerable<CredentialDescription>)

重設憑證描述清單中的所有憑證。 例如,在重試前使用。

ResetCredentials(IEnumerable<CredentialDescription>)

重設憑證描述清單中可重設的憑證(例如重設憑證以便重新載入)。例如,在重試前使用。

(繼承來源 DefaultCredentialsLoader)

適用於