dotnet / dotnet/aspnetcore

Blazor WASM: RemoteAuthenticatorViewCore prevents use of ApplicationPaths.RemoteRegisterPath

Open
#25,153 8 comments 17 reactions 0 assignees View on GitHub
affected-most area-blazor enhancement feature-blazor-wasm feature-blazor-wasm-auth Pillar: Cloud Integration severity-minor triaged
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

I am building a Blazor WASM application that's connected to IdentityServer4.

The template for Single User Accounts provides ```LoginDisplay.razor``` which includes the following line:

```Register```

After getting IdentityServer4 integrated via the following article, I noticed that the ```Register``` link simply redirected back to the Blazor app without any error messages.

https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-identity-server?view=aspnetcore-3.1&tabs=visual-studio

It wasn't clear what the ```RemoteAuthenticatorView``` was doing, so I dug into the code and came across the following:

https://github.com/dotnet/aspnetcore/blob/c21841f52e066400aae85a776f7b901fdca904e3/src/Components/WebAssembly/WebAssembly.Authentication/src/RemoteAuthenticatorViewCore.cs#L356

It's clear that ```ApplicationPaths.RemoteRegisterPath``` is being used for the redirect, but there is no documentation describing this. After setting the value to my external identity site ```https://localhost:44312/Identity/Account/Register``` (different site entirely), I was presented with ```Sorry, there's nothing at this address.``` in the Blazor app.

Looking closer at the above line of code, the ```.PathAndQuery``` piece at the end prevents ```ApplicationPaths.RemoteRegisterPath``` from ever being outside the Blazor app.

As a result, setting ```ApplicationPaths.RemoteRegisterPath``` to ```https://localhost:44312/Identity/Account/Register``` executes a redirect to ```https://localhost:44357/Identity/Account/Register``` (my Blazor app).

Please confirm that this is a bug.

Edit: ```ApplicationPaths.RemoteProfilePath``` seems to have the same issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.