Skip to content

[dotnet] [bidi] Decouple AuthCredentials in Network module #15491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions dotnet/src/webdriver/BiDi/Modules/Network/AuthCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@

namespace OpenQA.Selenium.BiDi.Modules.Network;

[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(Basic), "password")]
public abstract record AuthCredentials
public record AuthCredentials(string Username, string Password)
{
public record Basic(string Username, string Password) : AuthCredentials;
[JsonInclude]
internal string Type { get; } = "password";
}


2 changes: 1 addition & 1 deletion dotnet/test/common/BiDi/Network/NetworkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public async Task CanContinueWithAuthCredentials()
await using var intercept = await bidi.Network.InterceptAuthAsync(async e =>
{
//TODO Seems it would be better to have method which takes abstract options
await e.Request.Request.ContinueWithAuthAsync(new AuthCredentials.Basic("test", "test"));
await e.Request.Request.ContinueWithAuthAsync(new AuthCredentials("test", "test"));
});

await context.NavigateAsync(UrlBuilder.WhereIs("basicAuth"), new() { Wait = ReadinessState.Complete });
Expand Down