Skip to content
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

Doesn't support matrix urls because semicolons get encoded. #104

Closed
shonng opened this issue Aug 6, 2017 · 1 comment
Closed

Doesn't support matrix urls because semicolons get encoded. #104

shonng opened this issue Aug 6, 2017 · 1 comment
Assignees

Comments

@shonng
Copy link

shonng commented Aug 6, 2017

Angular 2 uses matrix urls by default instead of querystrings. Matrix urls use semicolons which are part of the path instead of querystrings.

Example url:
http://localhost:53276/report/balance-sheet-k;locationId=4;year=2017;period=6

Authorization call from OWIN:
https:// login.microsoftonline.com/{guid}/oauth2/authorize?client_id={client id}&response_mode=form_post&response_type=code+id_token&scope=openid+profile&state=OpenIdConnect.AuthenticationProperties%3dt5yyZoleJsYyxRLKoLRd7b9jkuTde73pbhwS0weZ_kxZ7Gnn1owouZBUZ7waDEYjxLxgKetCznfWb-U57ehIKeWlqO_VGIF5QVCgEkqqGl-D9zyWx-w8uomBUeUSvxaVXJTz2Qe8-H-s1N9UOLKEHrflZoIu4NwC-sXmFDWaam5EffkhgjhWcBeU2L5pznLwZTjWhQiWpYlqgO0aq-cpzQ&nonce=636371414679867284.ZDRlNjk5YzUtZWI1MC00NzA1LTk2YzktODIyNGVhNTllOTIzM2Y3NWY5ODUtZjJkNy00NmZlLWFiZTMtYzRjNWI3YjFkNzYz

Redirect url from Microsoft.Owin: http:// localhost:53276/report/balance-sheet-k%3BlocationId%3D4%3Byear%3D2017%3Bperiod%3D6

I think the issue is at
src/Microsoft.Owin.Security.OpenIdConnect/OpenidConnectAuthenticationHandler.cs
line 151 where is calls Uri.EscapeDataString(). Semicolons aren't in the list of unreserved characters so they get encoded.

@Tratcher
Copy link
Member

Tratcher commented Nov 2, 2017

Your example url was for the initial request that was lacking credentials and initiated the login flow? In that case then it looks like the encoding issues happen here where it captures the initial url for later use:



return String.Join("/", _value.Split('/').Select(EscapeDataString));

This has been rewritten for Core and looks more compliant:
https://github.com/aspnet/HttpAbstractions/blob/c0f937239a0a099b73c67c96ab9e1c875952f67f/src/Microsoft.AspNetCore.Http.Abstractions/PathString.cs#L71

That would be a lot of code to copy.

Workaround: Initiate the login from a dedicated endpoint that does not use urls like this.

@Tratcher Tratcher added this to the 4.0.0-rc1 milestone Nov 7, 2017
@Tratcher Tratcher closed this as completed Nov 7, 2017
@ghost ghost locked as resolved and limited conversation to collaborators Jan 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants