HTTP API Toolkit HTTP API Toolkit
HTTP API Toolkit HTTP API Toolkit
DocFX + Singulink = ♥

Search Results for

    Class LoopbackWebAuthenticationBrokerProvider

    A web authentication broker for Uno Platform desktop apps, which Uno doesn't provide one for. It opens the request in the default browser and receives the result on a loopback address (http://127.0.0.1:{port}/callback), the standard way for native apps to get a result back from the browser (RFC 8252).

    Inheritance
    object
    LoopbackWebAuthenticationBrokerProvider
    Implements
    IWebAuthenticationBrokerProvider
    Namespace: Singulink.Net.Http.Api.Client
    Assembly: Singulink.Net.Http.Api.Client.WinUI.dll
    Syntax
    public sealed class LoopbackWebAuthenticationBrokerProvider : IWebAuthenticationBrokerProvider
    Remarks

    The browser is opened at a short address on the same port (http://127.0.0.1:{port}/start) that redirects to the request. If the browser doesn't open it within StartTimeout, AuthenticateAsync(WebAuthenticationOptions, Uri, Uri, CancellationToken) reports Windows.Security.Authentication.Web.WebAuthenticationStatus.ErrorHttp instead of waiting for the full Timeout.

    PasskeyAuthenticator runs the same flow on desktop itself, with the hand-off settings of its PasskeyAuthenticatorOptions (CompletedMessage, Timeout and StartTimeout), whether or not this provider is registered, so this provider's settings don't apply to passkey operations. Register(Action<LoopbackWebAuthenticationBrokerProvider>?) makes WebAuthenticationBroker use it.

    Constructors

    Name Description
    LoopbackWebAuthenticationBrokerProvider()

    Initializes a new instance of the LoopbackWebAuthenticationBrokerProvider class.

    Properties

    Name Description
    CompletedMessage

    Gets or sets the message shown in the browser after it returns to the app. Default is "You can close this tab and return to the app.".

    StartTimeout

    Gets or sets how long AuthenticateAsync(WebAuthenticationOptions, Uri, Uri, CancellationToken) waits for the browser to open before it reports Windows.Security.Authentication.Web.WebAuthenticationStatus.ErrorHttp. Default is 30 seconds.

    Timeout

    Gets or sets how long AuthenticateAsync(WebAuthenticationOptions, Uri, Uri, CancellationToken) waits for the browser to return before it reports Windows.Security.Authentication.Web.WebAuthenticationStatus.UserCancel. Default is null, which uses Uno's WinRTFeatureConfiguration.WebAuthenticationBroker.AuthenticationTimeout.

    Methods

    Name Description
    AuthenticateAsync(WebAuthenticationOptions, Uri, Uri, CancellationToken)

    Opens requestUri in the default browser and waits for the browser to return to callbackUri.

    GetCurrentApplicationCallbackUri()

    Starts listening on a free loopback port and returns the callback address on it, for use by the next AuthenticateAsync(WebAuthenticationOptions, Uri, Uri, CancellationToken) call.

    Register(Action<LoopbackWebAuthenticationBrokerProvider>?)

    Registers this provider as the app's web authentication broker provider. Call it at startup (e.g. in the desktop Program.Main), before WebAuthenticationBroker is first used.

    © Singulink. All rights reserved.