Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

How do I specifiy AccessDeniedPath? #878

Closed
alaatm opened this issue Jun 10, 2016 · 1 comment
Closed

How do I specifiy AccessDeniedPath? #878

alaatm opened this issue Jun 10, 2016 · 1 comment
Labels

Comments

@alaatm
Copy link

alaatm commented Jun 10, 2016

In RC2, it looks like we no longer use app.UseCookieAuthentication(options => \* ... *\); but instead app.UseIdentity();. In this case, how can I set a custom value for AccessDeniedPath?

Also, how do I prevent the cookie auth middleware from doing the redirect all together. I would like to receive a 403 when authorization fails and handle it through app.UseStatusCodePagesWithReExecute("/h/{0}").

@Tratcher
Copy link
Member

The relationship between UseCookieAuthentication and UseIdentity has not changed in RC2. If you're using the Identity components you need to use UseIdentity, which internally registers several cookie auth instances. You can configure these via:

services.AddIdentity(options =>
{
  options.Cookies.ApplicationCookie.AccessDeniedPath = ...
});

You can override the behavior via the events:
#588 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants