Azure / Azure/data-api-builder

🥕[Bug]: `runtime` defaults start but do not run.

Aperta
#2,524 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
1.5k
Fork
370
Merge medio
3g 22h
PR unite (30g)
9

Descrizione

If you use all defaults in your configuration, like this:

## Configuration snippet

```json
"runtime": {
"mode": "development"
},
```

And then you `dab start` it runs!

However, when you navigate to the endpoint, you get:

```
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5000/ - - -
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HN9L5T7UV68Q", Request id "0HN9L5T7UV68Q:00000001": An unhandled exception was thrown by the application.
System.InvalidOperationException: No authentication handler is registered for the scheme 'OAuthAuthentication'. The registered schemes are: StaticWebAppsAuthentication. Did you forget to call AddAuthentication().Add[SomeAuthHandler]("OAuthAuthentication",...)?
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Azure.DataApiBuilder.Core.AuthenticationHelpers.ClientRoleHeaderAuthenticationMiddleware.InvokeAsync(HttpContext httpContext) in /_/src/Core/AuthenticationHelpers/ClientRoleHeaderAuthenticationMiddleware.cs:line 76
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Azure.DataApiBuilder.Service.Startup.<>c__DisplayClass15_0.<b__3>d.MoveNext() in /_/src/Service/Startup.cs:line 374
--- End of stack trace from previous location ---
at Azure.DataApiBuilder.Core.Services.PathRewriteMiddleware.InvokeAsync(HttpContext httpContext) in /_/src/Core/Services/PathRewriteMiddleware.cs:line 89
at Azure.DataApiBuilder.Core.Services.CorrelationIdMiddleware.Invoke(HttpContext httpContext) in /_/src/Core/Services/CorrelationIdMiddleware.cs:line 53
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5000/ - 500 0 - 30.5962ms
```

## Problem

```
No authentication handler is registered for the scheme 'OAuthAuthentication'. The registered schemes are: StaticWebAppsAuthentication. Did you forget to call AddAuthentication().Add[SomeAuthHandler]("OAuthAuthentication",...)?
```

Something changed to make this required.

## Also

```
Did you forget to call AddAuthentication().Add[SomeAuthHandler]("OAuthAuthentication",...)?
```

This is an internal message and should NOT be exposed.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da src/Core/AuthenticationHelpers/ClientRoleHeaderAuthenticationMiddleware.cs alla riga 76 e da src/Service/Startup.cs alla riga 374, usando la configurazione di runtime predefinita segnalata per riprodurre il problema della richiesta. Traccia il motivo per cui viene selezionato lo schema OAuthAuthentication quando è registrato solo StaticWebAppsAuthentication. Il lavoro è completato quando la configurazione predefinita serve correttamente l’endpoint e il messaggio interno del gestore di autenticazione non viene esposto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
api, authentication, backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.