Skip to content

Make it possible to turn off OpenID Connect configuration retrieval, or enable removal of an added authentication handler #61168

Open
@ChrisKlug

Description

@ChrisKlug

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

During integration testing with the WebApplicationFactory, I tend replace the existing authentication method (OIDC) with basic auth to simplify testing. However, in the current model, it seems more or less impossible to remove an authentication handler once it has been added. This is a problem with the OIDC handler, as it makes a request to retrieve the OIDC configuration on startup, which causes problems during testing.

Describe the solution you'd like

It would be great to be able to remove an authentication handler after it has been added, e.g. in the ConfigureTestServices method. Alternatively, it could be solved by being able to configure the OIDC handler to not get the configuration automatically.

Additional context

Right now, my solution is to set a specific environment name in the tests, and have code that checks the environment name before adding the OIDC handler. However, this feels less than optimal, as I don't want to have test specific code in my production application.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions