Skip to content

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

Open
@randelramirez

Description

@randelramirez

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions