I am running into the same issue as aghouton: https://github.com/orgs/falcoframework/discussions/148
- Expected: When a user has a required role, Request.ifAuthenticatedInRole runs the supplied httpHandler
- Expected: When an authenticated user does not have a required role, Request.ifAuthenticatedInRole does not run the supplied httpHandler
- Not Expected: When a user is not authenticated, Request.ifAuthenticatedInRole throws an exception.
I have reproduced the issue here: https://github.com/bkrug/expose-falco-role-authorization-bug
On my local PC, I have cloned the Falco repo written the following test.
I have also written code to make the test pass.
I would be willing to push a branch and create a pull request, or to share my branch in any other way.
[<Fact>]
let ``Request.ifAuthenticatedInRole should block non-authenticated users`` () =
let ctx = getHttpContextWriteable false
let mutable visited = false
let handle : HttpHandler = fun ctx ->
visited <- true
Response.ofEmpty ctx
task {
do! Request.ifAuthenticatedInRole AuthScheme ["admin2"] handle ctx
visited |> should equal false
}
I am running into the same issue as aghouton: https://github.com/orgs/falcoframework/discussions/148
I have reproduced the issue here: https://github.com/bkrug/expose-falco-role-authorization-bug
On my local PC, I have cloned the Falco repo written the following test.
I have also written code to make the test pass.
I would be willing to push a branch and create a pull request, or to share my branch in any other way.