asp.net-identity

Error: “The Id field is required.” while registering new user in database with AspNet.Identity 2.0

孤街浪徒 提交于 2020-01-02 09:58:18
问题 Welcome, I get the validation error mentioned in topic while creating (registering) new user in my Asp.Net mvc application where I used Asp.Net Identity with my custom ApplicationUser class public class ApplicationUser : IdentityUser<string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim> { public async Task<ClaimsIdentity> GenerateUserIdentityAsync(ApplicationUserManager manager) { var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes

Many to many relation between Identity and custom table. EF7 - Code first

家住魔仙堡 提交于 2020-01-02 05:02:14
问题 How can I make many to many relation between AspNetRoles from Identity 3.0 and my custom table? I want simple 3 table, with both PermissionId and RoleId, something like AspNetUsersRole. I have something like this: public class Permission { public int PermissionId { get; set; } public string Name { get; set; } public virtual ICollection<ApplicationRole> Roles { get; set; } } public class ApplicationRole : IdentityRole { public virtual ICollection<Permission> Permissions { get; set; } } But

The type ApplicationUser cannot be used as type parameter 'TUser' in the generic type or method 'IdentityDbContext<TUser>'

ε祈祈猫儿з 提交于 2020-01-02 04:09:19
问题 Trying to implement Identity in ASP.NET Core 2.0. Having many problems getting my head around this. Startup.cs public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer

How to setup a custom authentication on asp.net mvc identity?

笑着哭i 提交于 2020-01-02 03:42:05
问题 What I Need?! I have an ASP.NET identity system setup and running with external logins. For whatever reason i need to setup a custom authentication after the ASP.NET identity authentication. Let me explain how? Lets say I have three pages for the users to view on my application, Page A,B,C. Who can view Page A? Any anonymous user can view page A. Who can view Page A & B? Any user who have created an account either with his/her email & password or with external logins. Who can view Page A,B &

How to persist the login information after closing Browser using asp.net Identity?

你说的曾经没有我的故事 提交于 2020-01-02 03:18:47
问题 When using the ASP.NET Identity, I want to persist the login information as long as possible when the user logs in to my website, so the user doesn't need to login again when they reopened their Browser (just like github.com and stackoverflow.com). When I login to github, it persists my information for many days, so I don't need to login again every day. Are there any methods can that can implement this functionality using ASP.NET Identity? 回答1: Just pass the appropriate value to the

How to check password manually in Asp.Net identity 2?

强颜欢笑 提交于 2020-01-02 02:17:08
问题 This might actually be more of a conceptual question. In Asp.Net Identity the PasswordHasher generates a different hash for the same string every time you do: new PasswordHasher.HashPassword("myString"); Now if for some reason I need to manually compare a user's input to the password saved in the database, I will most probably get a different string when I hash the user's entered password, than the one that is stored in the database. Can someone please explain this to me? Shouldn't hashing

DynamoDB consistent reads for Global Secondary Index

点点圈 提交于 2020-01-01 09:41:51
问题 Why cant I get consistent reads for global-secondary-indexes? I have the following setup: The table: tblUsers (id as hash) Global Secondary Index: tblUsersEmailIndex (email as hash, id as attribute) Global Secondary Index: tblUsersUsernameIndex (username as hash, id as attribute) I query the indexes to check if a given email or username is present, so I dont create a duplicate user. Now, the problem is I cant do consistent reads for queries on the indexes. But why not? This is one of the few

DynamoDB consistent reads for Global Secondary Index

a 夏天 提交于 2020-01-01 09:41:40
问题 Why cant I get consistent reads for global-secondary-indexes? I have the following setup: The table: tblUsers (id as hash) Global Secondary Index: tblUsersEmailIndex (email as hash, id as attribute) Global Secondary Index: tblUsersUsernameIndex (username as hash, id as attribute) I query the indexes to check if a given email or username is present, so I dont create a duplicate user. Now, the problem is I cant do consistent reads for queries on the indexes. But why not? This is one of the few

ASP.NET Identity Extend methods to access user properties

爷,独闯天下 提交于 2020-01-01 08:46:47
问题 As I can extend methods to access user properties? There are methods like: User.Identity.GetUserId() User.Identity.GetUserName() Which are accessible from the views and the controllers. I want to extend this functionality with methods like: User.Identity.GetUserPhoneNumber() User.Identity.GetUserLanguaje() 回答1: Similar Question: Need access more user properties in User.Indentity answered by Microsoft professionals at codeplex worklog as below "You can get the User object and do User.Email or

Reuse Claim in regenerateIdentityCallback in Owin Identity in MVC5

自古美人都是妖i 提交于 2020-01-01 08:43:08
问题 I am using MVC5 with Owin identity. I am struggling to reuse any custom Claims in regenerateIdentityCallback. I have in Startup this configuration (as provided in the standard Template for new MVC project) app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity