CredentialProviderFactory
- Namespace:
PPDS.Auth.Credentials - Assembly:
PPDS.Auth - Kind: Class
Summary
Factory for creating credential providers from auth profiles.
Members
Methods
Create
ICredentialProvider Create(AuthProfile profile, Action<DeviceCodeInfo> deviceCodeCallback, Func<Action<DeviceCodeInfo>, PreAuthDialogResult> beforeInteractiveAuth)
Creates a credential provider synchronously. Prefer CreateAsync when possible for better performance with secure store lookups.
-
Param
profile: The auth profile. -
Param
deviceCodeCallback: Optional callback for device code display. -
Param
beforeInteractiveAuth: Optional callback invoked before browser opens for interactive auth. Returns the user's choice (OpenBrowser, UseDeviceCode, or Cancel). -
Returns: A credential provider for the profile's auth method.
CreateAsync
Task<ICredentialProvider> CreateAsync(AuthProfile profile, ISecureCredentialStore credentialStore, Action<DeviceCodeInfo> deviceCodeCallback, Func<Action<DeviceCodeInfo>, PreAuthDialogResult> beforeInteractiveAuth, string clientSecretOverride, CancellationToken cancellationToken)
Creates a credential provider for the specified auth profile.
-
Param
profile: The auth profile. -
Param
credentialStore: Optional secure credential store for looking up secrets. -
Param
deviceCodeCallback: Optional callback for device code display. -
Param
beforeInteractiveAuth: Optional callback invoked before browser opens for interactive auth. Returns the user's choice (OpenBrowser, UseDeviceCode, or Cancel). -
Param
clientSecretOverride: Optional client secret that takes priority over env var and credential store lookups. -
Param
cancellationToken: Cancellation token. -
Returns: A credential provider for the profile's auth method.
GetSpnSecretFromEnvironment
string GetSpnSecretFromEnvironment()
Gets the SPN secret from environment variables, checking both production and test variables. Returns null if neither is set.
IsSupported
bool IsSupported(AuthMethod authMethod)
Checks if the specified auth method is supported.
RequiresCredentialStore
bool RequiresCredentialStore(AuthMethod authMethod)
Checks if the specified auth method requires a secure credential store.
ShouldBypassCredentialStore
bool ShouldBypassCredentialStore()
Returns true if credential store should be bypassed (SPN secret is available via environment).
Fields
SpnSecretEnvVar
string SpnSecretEnvVar
Environment variable name for service principal secret bypass. When set, this value is used instead of looking up from secure store.
TestClientSecretEnvVar
string TestClientSecretEnvVar
Fallback environment variable for test scenarios.
Checked when PPDS.Auth.Credentials.CredentialProviderFactory.SpnSecretEnvVar is not set.