AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Windows Authentication - Configure AccessDeniedPath

Open Trcx528 opened this issue 8 years ago • 8 comments

When an authorization policy fails a completely blank page is returned when using windows auth. With other authentication options, like cookie authentication, one can configure an AccessDeniedPath to redirect a user too in this scenario. What is the equivalent for windows authentication? The documentation seems to gloss over this detail.

Trcx528 avatar Feb 16 '18 22:02 Trcx528

@HaoK Any ideas? Is something lacking in that doc?

scottaddie avatar Feb 16 '18 22:02 scottaddie

@Tratcher what are people supposed to do when windows auth fails?

HaoK avatar Feb 16 '18 22:02 HaoK

I think they probably can just do the equivalent manually... check for authZ failure, and redirect to the "AccessDeniedPage". Sound reasonable @blowdart ?

HaoK avatar Feb 16 '18 22:02 HaoK

I presume you're getting a 403 status? I'm not sure what Windows auth would do at this point to be honest, but yea a redirect works.

blowdart avatar Feb 16 '18 22:02 blowdart

You could use the StatusCode middleware to provide content. I don't recommend redirecting, you'd loose the protocol 401/403 semantics.

Tratcher avatar Feb 16 '18 22:02 Tratcher

Ah, I didn't mean redirect as in HTTP redirect :) I figured some magical inline redirect

blowdart avatar Feb 16 '18 22:02 blowdart

Ah, yeah, the StatusCodes middleware will do that for you.

Tratcher avatar Feb 16 '18 23:02 Tratcher

Yes, I am getting 403 status. I was able to configure the StatusCodePages middleware to add the desired error pages. I do feel like this needs to be noted in the documentation somewhere, even just a link to the StatusCodePages middleware. Otherwise the documentation feels incomplete.

Trcx528 avatar Feb 19 '18 15:02 Trcx528