Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to plug-in identity without relying on the scaffolder. #6990

Closed
Rick-Anderson opened this issue Jun 12, 2018 · 0 comments
Closed

how to plug-in identity without relying on the scaffolder. #6990

Rick-Anderson opened this issue Jun 12, 2018 · 0 comments
Assignees
Labels

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Jun 12, 2018

Copy from aspnet/Identity#1825

These are the important bits to know if you have scaffolded the code into your app and don't want to use default identity at all UI.

Configure MVC to authorize the Identity pages that require authorization:

services.AddMvc()
   .AddRazorPages(options =>
       {
           options.AllowAreas = true;
           options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage");
           options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout");
      });

Configure the cookie to point to the identity pages paths

services.ConfigureNamedOptions<CookieAuthenticationOptions>(options =>
{
    options.LoginPath = $"/Identity/Account/Login";
    options.LogoutPath = $"/Identity/Account/Logout";
    options.AccessDeniedPath = $"/Identity/Account/AccessDenied";
});

Regarding the fact that we rely on the scaffolder in our docs, its totally fine. The alternative is to tell you to copy paste a bunch of code in the docs into your project which is inevitably going to go out of sync. The scaffolder is the source of truth.

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

No branches or pull requests

1 participant