Force https for OIDC behind proxy

This commit is contained in:
Daniel J. Summers 2021-10-26 15:05:03 -04:00
parent 431afa10f5
commit e57057b5ee
2 changed files with 8 additions and 6 deletions

1
publish.ps1 Normal file → Executable file
View File

@ -1,2 +1,3 @@
#!/snap/bin/pwsh
Set-Location src/MyPrayerJournal Set-Location src/MyPrayerJournal
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained false dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained false

View File

@ -125,6 +125,12 @@ module Configure =
|> ctx.Response.Redirect |> ctx.Response.Redirect
ctx.HandleResponse () ctx.HandleResponse ()
Task.CompletedTask
opts.Events.OnRedirectToIdentityProvider <- fun ctx ->
let bldr = UriBuilder ctx.ProtocolMessage.RedirectUri
bldr.Scheme <- cfg["Scheme"]
bldr.Port <- int cfg["Port"]
ctx.ProtocolMessage.RedirectUri <- string bldr
Task.CompletedTask Task.CompletedTask
) )
|> ignore |> ignore
@ -153,12 +159,7 @@ module Configure =
.UseRouting() .UseRouting()
.UseAuthentication() .UseAuthentication()
.UseGiraffeErrorHandler(Handlers.Error.error) .UseGiraffeErrorHandler(Handlers.Error.error)
// .UseAuthorization() .UseEndpoints (fun e -> e.MapGiraffeEndpoints Handlers.routes |> ignore)
.UseEndpoints (fun e ->
e.MapGiraffeEndpoints Handlers.routes
// TODO: fallback to 404
// e.MapFallbackToFile "index.html"
|> ignore)
|> ignore |> ignore
app app