Skip to content

HTTP local server fallback for WebAuthenticationBroker - #73

Merged
maxkatz6 merged 9 commits into
mainfrom
feature/webauth-local-server
Aug 14, 2026
Merged

HTTP local server fallback for WebAuthenticationBroker#73
maxkatz6 merged 9 commits into
mainfrom
feature/webauth-local-server

Conversation

@maxkatz6

@maxkatz6 maxkatz6 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Closes #26

System OAuth WebAuthenticationBroker implementation is not always available. And NativeWebDialog implementation might not be desirable (as it's not connected with user browser sessions).

In the wild, many apps implement HTTP listener, including our own tooling. This new WebAuthenticationBroker brings the same fallback to this library.

New API:

public record WebAuthenticatorOptions(Uri RequestUri, Uri RedirectUri)
{
+   public WebAuthenticatorMode Mode { get; init; }

+   [Obsolete("Use Mode = WebAuthenticatorMode.NativeWebDialog instead.")]
    public bool PreferNativeWebDialog { get; init; }

    public bool NonPersistent { get; init; }

    public Func<NativeWebDialog?>? NativeWebDialogFactory { get; init; }

+   public BrowserOptions? BrowserOptions { get; init; }
}
public enum WebAuthenticatorMode
{
    Auto,

    [SupportedOSPlatform("macos")]
    [SupportedOSPlatform("ios")]
    [SupportedOSPlatform("android")]
    [SupportedOSPlatform("browser")]
    System,

    [SupportedOSPlatform("windows")]
    [SupportedOSPlatform("macos")]
    [SupportedOSPlatform("android")]
    [SupportedOSPlatform("linux")]
    NativeWebDialog,

    [UnsupportedOSPlatform("browser")]
    Browser
}

public record BrowserOptions
{
    public TimeSpan Timeout { get; init; } = TimeSpan.FromMinutes(5);

    public BrowserResponseHandler? ResponseHandler { get; init; }

    public BrowserCallbackFilter? CallbackFilter { get; init; }

    public delegate Task BrowserResponseHandler(
        WebAuthenticationResult result, BrowserResponse response);

    public delegate bool BrowserCallbackFilter(
        WebAuthenticationResult result);
}

public sealed class BrowserResponse
{
    public HttpStatusCode StatusCode { get; set; }
    public Stream OutputStream { get; }
    public void Redirect(Uri uri)
}

@maxkatz6
maxkatz6 merged commit 7b7b4f8 into main Aug 14, 2026
1 check passed
@maxkatz6
maxkatz6 deleted the feature/webauth-local-server branch August 14, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP local server fallback for WebAuthenticationBroker

1 participant