Skip to content

context.ProtocolMessage.Prompt is not working on Microsoft.AspNetCore.Authentication.OpenIdConnect #61820

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

Open
1 task done
randelramirez opened this issue May 7, 2025 · 2 comments
Assignees
Labels
area-security feature-oidc investigate Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update.
Milestone

Comments

@randelramirez
Copy link

randelramirez commented May 7, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a ASP.NET 9 BFF that connects to Keycloak for Auth.

On my BFF I have a /bff/register endpoint like this:

app.MapGet("/bff/register", (HttpContext context) =>
{
    var authProperties = new AuthenticationProperties()
    {
        RedirectUri = "/",
    };

    return Results.Challenge(authProperties,
        new List<string> { "oidc" });
});

and on my OpenIdConnect setup:

options.Events = new OpenIdConnectEvents
        {
            OnRedirectToIdentityProvider = context =>
            {
                if (context.Request.Path.HasValue && context.Request.Path.Value.Contains("bff/register"))
                {
                    context.ProtocolMessage.Prompt = "create";
                }

                return Task.CompletedTask;
            }
        };

With this setup the registration page of Keycloak is shown when using "Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.15"

But when I migrated to version 9, it seems the prompt parameter is not being passed properly because the Login UI is displayed instead of the User Registration UI

Expected Behavior

The prompt should be passed properly to the Auth flow properly

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

@github-actions github-actions bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label May 7, 2025
@martincostello martincostello added feature-oidc area-security and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels May 7, 2025
@MackinnonBuck
Copy link
Member

Thanks for reaching out, @randelramirez.

Would you be able to provide us with a network trace from your browser?

@MackinnonBuck MackinnonBuck added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label May 12, 2025
@randelramirez
Copy link
Author

randelramirez commented May 15, 2025

Thanks for reaching out, @randelramirez.

Would you be able to provide us with a network trace from your browser?

Here's a network trace for OpenIdConnect 8.0.15 prompt=create is working

OpenIdConnect_8.0.15.har.zip

For OpenIdConnect 9.0.5 prompt=create does not work

OpenIdConnect_9.0.5.har.zip

@MackinnonBuck

@dotnet-policy-service dotnet-policy-service bot added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels May 15, 2025
@MackinnonBuck MackinnonBuck added this to the 10.0-preview6 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-security feature-oidc investigate Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update.
Projects
None yet
Development

No branches or pull requests

4 participants