You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 20, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 20, 2024. It is now read-only.
Angular SPA Template with Individual Auth doesn't work when the project name contains spaces #675
Run dotnet new angular --auth Individual --name "Test Project" --output "Test Project"
Open Test Project.csproj in an IDE
Run Test Project (only tested without IIS Express, but it probably doesn't matter)
Wait for the SPA Proxy to launch
Open the SPA and click Login
Observe the log output:
Log Output (Click to Open)
fail: Duende.IdentityServer.Validation.DefaultResourceValidator[0]
Scope Test not found in store or not supported by requested resource indicators.
fail: Duende.IdentityServer.Validation.DefaultResourceValidator[0]
Scope ProjectAPI not found in store or not supported by requested resource indicators.
fail: Duende.IdentityServer.Endpoints.AuthorizeEndpoint[0]
Request validation failed
When the Angular client tries to log in with OpenID Connect, it requests the scopes of Test ProjectAPI openid profile. This should probably be Test_ProjectAPI openid profile. I'm not sure if the scopes are being set correctly in the backend by the Identity Server. This breaks the login/registration flow as well as the Fetch Data tab. I haven't tested this with the React or Vue templates, but it is possible that this issue might not only occur in the Angular template.
Specifications
OS: Windows 11 21H2 IDE: JetBrains Rider 2022.1.1 .NET: v6.0.202
Note:
I'm not sure whether this is an issue with the Angular SPA template, the Identity Server, or ASP.NET Core. If this issue would be better suited to another repository, please let me know.
I'm not sure if OpenID Connect scopes can contain spaces. If scopes can be quoted in the request, they likely can, but I'm not sure how the specification reads. If scopes can contain spaces, the error is in the client (the scope needs to be quoted). If scopes cannot contain spaces, the error is in the server (the scope needs an underscore instead of a space).
The value of the scope parameter is expressed as a list of space-delimited, case-sensitive strings. The strings are defined by the authorization server. If the value contains multiple space-delimited strings, their order does not matter, and each string adds an additional access range to the requested scope.
It explicitly defines that scopes cannot contain spaces (%x20 = ) and that scopes cannot be quoted (%x22 = ").
Therefore, the error is in the server-side implementation. It should not allow a scope that contains a space. It should either throw an error, or replace the space with an underscore. If the space is allowed in the scope, the server will not be fully OAuth 2.0/OpenID Connect 1.0 compliant.
Activity
JeremyEastham commentedon May 11, 2022
I can verify that if I visit
/.well-known/openid-configurationthat thescopes_supportedarray includes aTest ProjectAPIscope.{ "scopes_supported": [ "openid", "profile", "Test ProjectAPI", "offline_access" ] }I'm not sure if OpenID Connect scopes can contain spaces. If scopes can be quoted in the request, they likely can, but I'm not sure how the specification reads. If scopes can contain spaces, the error is in the client (the scope needs to be quoted). If scopes cannot contain spaces, the error is in the server (the scope needs an underscore instead of a space).
JeremyEastham commentedon May 11, 2022
According to OAuth 2.0 RFC6749 Section 3.3:
It explicitly defines that scopes cannot contain spaces (
%x20=) and that scopes cannot be quoted (%x22=").Therefore, the error is in the server-side implementation. It should not allow a scope that contains a space. It should either throw an error, or replace the space with an underscore. If the space is allowed in the scope, the server will not be fully OAuth 2.0/OpenID Connect 1.0 compliant.