Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Map causes wrong ReturnUrl parameter for Cookies #1730

Closed
@Tratcher

Description

@Tratcher
            app.UseAuthentication();

            app.Map("/hello", map =>
            {
                map.Run(async context =>
                {
                    if (!context.User.Identities.Any(identity => identity.IsAuthenticated))
                    {
                        await context.ChallengeAsync();
                        return;
                    }

                    context.Response.ContentType = "text/plain";
                    await context.Response.WriteAsync("Hello old timer");
                });
            });

If UseAuthentication is outside of the Map, and ChallengeAsync is called inside the Map, then CookieAuth generates the wrong ReturnUrl parameter.

redirectUri = OriginalPathBase + Request.Path + Request.QueryString;

In the example http://localhost:12345/hello/world?query, it uses the OriginalPathBase (empty) but the current request Path "/world" and redirects to "/world?query". It should use the OriginalPathBase "" and the OriginalPath "/hello/world" rather than the current Path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcost: XSWill take about half a day to complete

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions