Replies: 2 comments 4 replies
-
Hey Deon, Interesting stuff here. You ultimately arrived at the solution I would have suggested given what was available in beta4. After some thought, I think we need to scope the Using final example, it would look like this: wapp.UseRouting()
.UseAuthentication()
.UseAuthorization()
.UseFalco(endpoints) I just deployed beta5 with this code. Have a crack at it, and let me know. Thanks for catching this silly oversight before we went to release. |
Beta Was this translation helpful? Give feedback.
-
Hey Deon,
It's a deceptive transformation, which is what gave me pause to include
those extension methods. But they're just so cool!
Basically the issue is your auth activations, they upcast the item flowing
through the chain to be IApplicationBuilder rather than WebApplication.
The way I get around this is to use the WebApplication Use extension and
the lesser known static extension methods to activate the middleware.
```
wapp.UseRouting().Use(AuthAppBuilderExtensions.UseAuthentication).Use(AuthorizationAppBuilderExtensions.UseAuthorization).UseFalco(endpoints).Run(Response.ofPlaintext
"Not found")
```
I'm on my phone, so check the syntax. Let me know if that works for you!
…On Sun, Jan 26, 2025, 12:57 AM Deon ***@***.***> wrote:
With the release of rc2 and the updated Hello world examples, ending a
WebApplication chain with Run is now working for me.
wapp.UseRouting().UseAuthentication().UseAuthorization().UseFalco(endpoints).Run(Response.ofPlaintext "Not found")
—
Reply to this email directly, view it on GitHub
<#130 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDB57MP3QSA25FPCE37RGT2MR2OHAVCNFSM6AAAAABS75LFYSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOJVGYYTAMY>
.
You are receiving this because you commented.
Message ID: <pimbrouwers/Falco/repo-discussions/130/comments/11956103@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
I tried 5.0.0 with aspnetcore's authorization middleware.
The current recommendation from MS is to add the default policy as the fallback policy, which requires all requests to be authenticated.
For unauthenticated access to routes, I've been making use of this helper function. Which I stole from pim's fix for route
Order
.A generic version could be
There's a couple of other considerations to go along with this.
UseFalco
currently callsUseRouting
andUseEndpoints
butUseAuthorization
needs to be called in between them. I've been using this workaroundIt's possible to add duplicate attributes into the Metadata collection. Not sure what the behaviour is when that happens.
Would it be useful to add these EndpointBuilder functions to Falco?
Beta Was this translation helpful? Give feedback.
All reactions