ServiceClientFactory
- Namespace:
PPDS.Auth - Assembly:
PPDS.Auth - Kind: Class
- Implements:
IDisposable
Summary
Factory for creating authenticated ServiceClient instances from profiles.
Members
Constructors
ServiceClientFactory(ProfileStore profileStore, Action<DeviceCodeInfo> deviceCodeCallback)
ServiceClientFactory(ProfileStore profileStore, Action<DeviceCodeInfo> deviceCodeCallback)
Creates a new ServiceClientFactory.
-
Param
profileStore: The profile store to use. -
Param
deviceCodeCallback: Optional callback for device code display.
Methods
CreateFromActiveProfileAsync
Task<ServiceClient> CreateFromActiveProfileAsync(string environmentUrl, CancellationToken cancellationToken)
Creates an authenticated ServiceClient for the active profile.
-
Param
environmentUrl: Optional environment URL override. If not specified, uses the profile's environment. -
Param
cancellationToken: Cancellation token. -
Returns: An authenticated ServiceClient.
CreateFromProfileNameAsync
Task<ServiceClient> CreateFromProfileNameAsync(string profileName, string environmentUrl, CancellationToken cancellationToken)
Creates an authenticated ServiceClient for a specific profile by name.
-
Param
profileName: The profile name. -
Param
environmentUrl: Optional environment URL override. -
Param
cancellationToken: Cancellation token. -
Returns: An authenticated ServiceClient.
CreateFromProfileNamesAsync
Task<IReadOnlyList<ServiceClient>> CreateFromProfileNamesAsync(IEnumerable<string> profileNames, string environmentUrl, CancellationToken cancellationToken)
Creates authenticated ServiceClients for multiple profiles (for pooling).
-
Param
profileNames: The profile names. -
Param
environmentUrl: Environment URL (required if any profile has no environment). -
Param
cancellationToken: Cancellation token. -
Returns: List of authenticated ServiceClients.
Dispose
void Dispose()
(inherited from System.IDisposable.Dispose)