Interface IAuthenticationExternalProvider
- Namespace
- VpnHood.AppLib.Abstractions.Accounts
- Assembly
- VpnHood.AppLib.Abstractions.dll
Represents an identity provider's own sign-in on the device, as Google's or Apple's, which gives the ID token the account backend verifies.
public interface IAuthenticationExternalProvider : IDisposable
- Inherited Members
Properties
ProviderId
The identity provider this implementation drives, self-declared as a free-form string id (lowercase by convention; see AuthProviders for the well-known ones) so nothing downstream ever hardcodes it: the portal sends it verbatim as the wire discriminator, AppDescriptor reports it, and the UI picks the matching "Sign in with X" label. A string rather than an enum so a third-party app on these packages can add its own provider — no library change, no consumer changes.
string ProviderId { get; }
Property Value
Methods
SignIn(IUiContext?, bool, CancellationToken)
Signs the person in with the identity provider.
Task<string> SignIn(IUiContext? uiContext, bool isSilentLogin, CancellationToken cancellationToken)
Parameters
uiContextIUiContextThe window, or null where none is open.
isSilentLoginbooltrue where the person did not ask to sign in, as for a renewal, so the provider avoids a prompt where it can.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- UiContextNotAvailableException
uiContextis null, and the provider shows a sheet.- AuthenticationException
The identity provider gave no ID token, as Google's where the device has no Google account.
- InvalidOperationException
isSilentLoginis true where the provider cannot sign in without the person, as Apple's while the app is not in front.- OperationCanceledException
The person canceled the sign-in, or
cancellationTokenwas canceled.
SignOut(IUiContext?, CancellationToken)
Clears the identity provider's sign-in on this device, where it keeps one.
Task SignOut(IUiContext? uiContext, CancellationToken cancellationToken)
Parameters
uiContextIUiContextThe window, or null where none is open.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- UiContextNotAvailableException
uiContextis null, and the provider needs a window to clear it.- ApiException
The platform failed to clear it, as Google's credential manager reports a failure or a cancel.