GFlisch / Arc4u.Guidance.Doc

Other
5 stars 1 forks source link

Missing BasicAuthentication setup #173

Closed refactorinc closed 1 year ago

refactorinc commented 1 year ago

Describe the bug Basic authentication is not configured out-of-the-box

To Reproduce Steps to reproduce the behavior:

  1. Create blank solution
  2. Generate guidance solution
  3. Observe Program.cs in Yarp project has no app.UseBasicAuthentication

Expected behavior Basic authentication is configured by default

Desktop (please complete the following information):

rdarko commented 1 year ago

this should not be set up by default. Default would be OIDC. Basic Auth should be setup only for the projects who explicitly use it.

GFlisch commented 1 year ago

From Guidance 2021.2.1.11 a bug for some configuration has been introduce and the use of the Basic authentication is not injected in the Program.cs.

Has the version 13 of the Guidance will support the refactoring currently in test, this will be fixed.

Waiting this, you have just to add in the Program.cs of the Yarp project those lines of code after the app.UseCors();:

app.UseCors();

var basicSettings = new BasicTokenSettingsReader(Configuration);

app.UseBasicAuthentication(container, new BasicAuthenticationContextOption
{
    Settings = basicSettings
});

As the settings and reader for the settings are well generated, there is no other actions to do...