asp.net-identity

ASP.Net Identity - Multiple Authentication Methods

和自甴很熟 提交于 2020-01-15 09:15:48
问题 Is it possible to configure the new ASP.Net Identity system to support multiple authentication methods? I have a requirement to support both Windows authentication (Intranet) and application level users (ideally using the Entity Framework option). This seems to be almost impossible in the old ASP.Net Membership world but has anything changed with the new OWIN based implementation? I need a scenario where Windows Auth is attempted first and then, if it fails, the site falls back to application

How to tell the primary key 'Id' of IdentityUser class is IDENTITY(1,1)?

梦想与她 提交于 2020-01-15 09:08:25
问题 I have changed the type of primary key of IdentityUser class from string to int following this. Now when I go to insert data in User table, it wants data for Id field. But I want that the value in Id field will be automatically created by Identity. In server explorer when I open table definition, it shows [Id] INT NOT NULL but I think it should be [Id] INT IDENTITY(1,1) NOT NULL So what should I do to make [Id] INT IDENTITY(1,1) NOT NULL 回答1: You need to add DatabaseGenerated

ASP.NET Identity Is default ApplicationUserManager implementing IUserEmailStore?

北城以北 提交于 2020-01-15 03:46:13
问题 Hello, I was looking into ASP.NET Identity source, particulary, in UserValidator. I wanted to rewrite it for my own project, to be able to change error messages. So I copy that class into my project. When I try to use it - I get an error - 'Microsoft.AspNet.Identity.UserManager<TUser,TKey>' does not contain a definition for 'GetEmailStore' and no extension method 'GetEmailStore' accepting a first argument of type 'Microsoft.AspNet.Identity.UserManager<TUser,TKey>' could be found (are you

using EF Core IdentityContext and DbContext both for order management

这一生的挚爱 提交于 2020-01-14 19:17:28
问题 I am working on creating an ecommerce website on ASP MVC Core 2. I inherited my user from IdentityUser and inherited context from IdentityDbContext for working with user data and inherited a different context from DbContext for working with products and orders etc. Now, I want to link an order or shopping cart to a particular user and can not wrap my head around how to refer to the user in order table as they are in different contexts. I am also using the default guid created by EF as primary

Change Primary Key for Asp.net Identity and GetUserID<int>

六月ゝ 毕业季﹏ 提交于 2020-01-14 03:45:07
问题 I am creating a WebAPI (OData) project and have used Asp.Identity for my user management. I have read through Change Primary Key for Users in ASP.NET Identity and everything works as prescribed, I do not know how to configure the Bearer token. In Tom FitzMacken's example, he configures Cookie Authentication as follows. app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"),

Asp.net core - no such table: AspNetUsers

喜欢而已 提交于 2020-01-13 19:03:31
问题 So im trying to implment user login for my a asp.net core application. Im following the microsoft tutorial here. I have two contexts, one called SchoolContext for saving all the school related models, and another context called ApplicationDbContext for the Account models. This is all being saved to a sqlite database. Everything works fine, up until I try to register a user to my context. When I try to register a user i get, cant find AspNetUsers table error. If I look in the database I don’t

Entity Framework Seeding with Identity (Microsoft.Owin.Security) user

房东的猫 提交于 2020-01-13 10:30:08
问题 I have a class that seed the database which add 2 users with roles and custom fields. The problem I have is that it save the data in [dbo].[AspNetUsers] instead of [dbo].[IdentityUsers]. Both tables are created. When seeded, the data go into AspNetUser. When I launch the web site, and register a new user, the data go into IdentityUser. Here is the Migration class : internal sealed class Configuration : DbMigrationsConfiguration<DatabaseContext> { public Configuration() {

AspNet.Identity Custom User and Custom Role should be simple; what am I missing?

偶尔善良 提交于 2020-01-13 03:53:09
问题 Using examples from http://www.asp.net/identity I've gotten this far. The RoleManager works flawlessly and I treat the UserManager the same. I think everything is correct, but I can't seem to new up a UserManager correctly in a controller. What is wrong? At one point, I was successfully getting the UserManager to work but was getting an EntityValidationError saying "Id is required" when creating a new user with UserManager.Create(user, password); as posted in this question UserManager.Create

ASP.NET Core Identity does not inject UserManager<ApplicationUser>

蓝咒 提交于 2020-01-12 14:26:07
问题 I've got an older asp.net core identity database, and I want to map a new project (a web api) to it. Just for the test, I copied the Models folder, and the ApplicationUser file from the previous project (ApplicationUser simply inherits from IdentityUser, no changes whatsoever) - doing DB first seems to be a bad idea. I'm registering Identity in ConfigureServices (but I'm not adding it to the pipeline since my only intention is to use the UserStore) services.AddIdentity<ApplicationUser,

How to allow user to register with duplicate UserName using Identity Framework 1.0

天大地大妈咪最大 提交于 2020-01-12 13:56:29
问题 I want to develop an application in MVC using Identity Framework 1.0 which allow users to register with same username used by some other user. When deleting a user I want to set its IsDeleted custom property to true rather than deleting the user from database. In this case another user can use the UserName of the user whose IsDeleted is set to true. But the default UserManager.CreateAsync(user, password); method is preventing doing this. I had overridden the ValidateEntity method of