Questions tagged [asp.net-identity-3]

The third release of the ASP.NET Identity system which was designed to replace the previous ASP.NET Membership and Simple Membership systems. Use this tag if your question deals specifically to ASP.NET Identity 3 features. The [asp.net-identity] tag should be used if your question is not specific to ASP.NET Identity 3.

229 questions
83
votes
8 answers

How to create roles in ASP.NET Core and assign them to users?

I am using the ASP.NET Core default website template and have the authentication selected as "Individual User Accounts". How can I create roles and assign it to users so that I can use the roles in a controller to filter access?
Bipn Paul
  • 1,155
  • 1
  • 10
  • 22
76
votes
6 answers

'No database provider has been configured for this DbContext' on SignInManager.PasswordSignInAsync

.Net Core 1.0.0 - SDK Preview 2 (x64) .Net Core 1.0.0 - VS "15" Preview 2 (x64) .Net Core 1.0.0 - Runtime (x64) So, we updated an RC1 app to the latest versions above. After many hours of switching references, it's running. However, when logging…
Beau D'Amore
  • 2,414
  • 4
  • 17
  • 45
32
votes
3 answers

How to make EF-Core use a Guid instead of String for its ID/Primary key

When I look at the ASP.NET 3 Identity it uses a string and not a Guid for the unique primary key. In my Entity Framework code first Users' ApplicationUser class I inherit the Identity class public class ApplicationUser : IdentityUser { } which…
32
votes
2 answers

How to use ASP.NET Identity 3.0 without Entity Framework

All examples I've seen by now for ASP.NET Identity 3.0 use Entity Framework to store user-related data. Are there any example which does not use Entity Framework and where ApplicationUser class is not derived from…
Sergiy
  • 1,807
  • 2
  • 16
  • 23
22
votes
1 answer

Add claims when creating a new user

I am creating a new User using ASP.NET Core Identity as follows: new User { Email = "john@company.com", Name = "John" } await userManager.CreateAsync(user, "password"); I need to add a Claims when creating the user. I tried: new User { Email…
Miguel Moura
  • 28,129
  • 59
  • 187
  • 356
21
votes
3 answers

Why does this violate the type constraint?

I'm trying to customise ASP.NET Identity 3 so that it uses integer keys: public class ApplicationUserLogin : IdentityUserLogin { } public class ApplicationUserRole : IdentityUserRole { } public class ApplicationUserClaim :…
James
  • 6,911
  • 9
  • 40
  • 80
20
votes
3 answers

ASP.NET Core Identity: No service for role manager

I have an ASP.NET Core app that uses Identity. It works, but when I am trying to add custom roles to the database I run into problems. In Startup ConfigureServices I have added Identity and the role manager as a scoped service like…
Glenn Utter
  • 2,113
  • 6
  • 22
  • 40
18
votes
2 answers

Is there UI to manage ASP.NET Identity users/roles compatible with ASP.NET 5?

I'm using: VS2015u2 ASP.NET 5 MVC 6 I'm looking for some UI to manage users/roles. Some things I've tried: Identity Manager - https://github.com/IdentityManager/IdentityManager I guess it's still not compatible with the latest asp changes.
f0rt
  • 1,435
  • 2
  • 12
  • 24
17
votes
6 answers

Checking login user AuthorizePolicy in Razor page on Asp.Net Core

I'm looking for a variant of this @if (SignInManager.IsSignedIn(User) && User.IsInRole(Roles.Administrator)) {
but instead of checking after the role I'm after a check into the policy much like you would in a controller…
17
votes
3 answers

ASP .NET 5 MVC 6 Identity 3 Roles Claims Groups

I'm currently looking for a solution to use an advanced Roles/Group Permission management in ASP .NET 5 MVC 6 with Identity 3. I started a new Preview Starter Web Project with a integrated easy login system. Now I need a complex "users permission…
15
votes
2 answers

Does SignInAsAuthenticationType allow me to get an OAuth token without overwriting existing claims?

I need a user to login to a website using out of the box authentication to Facebook. I now need to link to the users drive in Google (and other services). I want to use ASP.Net Identity OAuth Identity providers to handle the token exchange, BUT I…
halfbit
  • 54,462
  • 46
  • 195
  • 426
15
votes
3 answers

How to register custom UserStore & UserManager in DI

Here is my setup: public class ApplicationUser : IdentityUser { } public class ApplicationRole : IdentityRole { } public class ApplicationUserLogin : IdentityUserLogin { } public class ApplicationUserClaim :…
JuChom
  • 4,687
  • 4
  • 36
  • 64
14
votes
3 answers

userManager.AddToRoleAsync() - Error: role does not exist

I'm creating a user registration system using .NET Core, Identity Core, and MVC Core. I'm able to create users and create roles in the database. Here's the form on the view that lets me select a user and select a role to add: @using…
jmk22
  • 884
  • 3
  • 12
  • 27
13
votes
1 answer

what is the difference between ASP.NET Identity and IdentityServer?

I can not understand the difference between the two, asp.net identy is based on OWIN and does not introduce a middleware while IdentityServer introduced him, I'm confused ..
13
votes
3 answers

ASP.NET Core change AccessDenied route

I'm having some trouble with routing AccessDenied, probably Login/Logout path as well. The project is a stripped default one with no more magic. Soo there exist a Account controller with an AccessDenied() method. What I'm trying now is (this is the…
1
2 3
15 16