asp.net-core-identity

How to confirm a phone number in ASP.Net Core 1.1MVC

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 09:16:10
问题 I cannot figure out how to do a phone number confirmation in asp.net core 1.1 Identity service configuration contains explicit options to require confirmed email and/or phone number. It can be done the following way: services .AddIdentity<User, Role>(options => { options.SignIn.RequireConfirmedEmail = true; options.SignIn.RequireConfirmedPhoneNumber = true; }); The validation of the email is quite straight forward as the UserManager contains explicit token generator and its validator: var

How to redirect after Azure AD authentication to different controller action in ASP Net Core MVC

孤人 提交于 2019-12-31 03:12:06
问题 I have setup my ASP Net Core 2.0 project to authenticate with Azure AD (using the standard Azure AD Identity Authentication template in VS2017 which uses OIDC). Everything is working fine and the app returns to the base url (/) and runs the HomeController.Index action after authentication is successful. However I now want to redirect to a different controller action (AccountController.CheckSignIn) after authentication so that I can check if the user already exists in my local database table

.net core identity 2.1 role authorize not working

时间秒杀一切 提交于 2019-12-30 06:08:41
问题 I've implemented role based auth several times pre 2.1. Followed the steps to scaffold the new 2.1 identities. I extended the IdentityUser model to add additional fields, login works fine, new fields are present. startup.cs configure services contains services.AddDefaultIdentity<AppUser>() .AddRoles<IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>(); I seeded the roles IdentityRole role = new IdentityRole(); role.Name = "Administrator"; IdentityResult roleResult = roleManager.

.net core identity 2.1 role authorize not working

好久不见. 提交于 2019-12-30 06:08:27
问题 I've implemented role based auth several times pre 2.1. Followed the steps to scaffold the new 2.1 identities. I extended the IdentityUser model to add additional fields, login works fine, new fields are present. startup.cs configure services contains services.AddDefaultIdentity<AppUser>() .AddRoles<IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>(); I seeded the roles IdentityRole role = new IdentityRole(); role.Name = "Administrator"; IdentityResult roleResult = roleManager.

ASP.Net Core localization

坚强是说给别人听的谎言 提交于 2019-12-29 06:49:11
问题 ASP.Net core features new support for localization. In my project I need only one language. For most of the text and annotations I can specify things in my language, but for text coming from ASP.Net Core itself the language is English. Examples: Passwords must have at least one uppercase ('A'-'Z'). Passwords must have at least one digit ('0'-'9'). User name 'x@x.com' is already taken. The E-post field is not a valid e-mail address. The value '' is invalid. I've tried setting the culture

Store does not implement IUserRoleStore<TUser> UserManager<TUser>.GetUserRoleStore() ASP.NET Core MVC 3

╄→гoц情女王★ 提交于 2019-12-24 19:53:10
问题 I have implemented Identity in Asp.Net.Core MVC 3 because we already have database tables that we want to use. I get the error when calling the methods below and they are both happening in the UserManager in the same call to the method. When looking at the source code for this method it is because the Store variable is null. But I am not quite sure how to make sure it is not null. I have looked at various solutions online but none solve my problem. My solution is working with the

ASP.NET Core Identity - LoginPartial broken after scaffolding identity

一笑奈何 提交于 2019-12-24 02:59:07
问题 I created a new Project from the VS 2017 template (web application with individual user accounts). This adds the ASP.NET Core Identity as default UI (using the UI from a nuget). services .AddDefaultIdentity<IdentityUser>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders(); With this nuget everything works as expected. Especially the loginPartial which shows the username once a user has logged in and shows the Login Button right after clicking logout. Once I

Auto Login on debug ASP.Net Core 2.1

吃可爱长大的小学妹 提交于 2019-12-23 18:18:36
问题 I am trying to auto login for debugging purposes on an ASP.net core 2.1 application I've built. Getting the Error : HttpContext must not be null. The code below sits in the Startup.cs file // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider ServiceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home

.NET Core 2.1 Identity : Creating a table for each Role + bridge M:M table

北城以北 提交于 2019-12-23 03:15:19
问题 I'm having issues in figuring out the best design that fits my needs regarding a Role based authorizations using Identity in a .NET Core 2.1 project. I already extended the User class from Identity with an ApplicationUser class. I need 5 different roles to control the access to the different features of the app : Admin, Teacher, Student, Parent and Supervisor All the common attributes are kept in User and ApplicationUser but I still require different relationships to other tables depending of

.NET Core 2.1 Identity : Creating a table for each Role + bridge M:M table

主宰稳场 提交于 2019-12-23 03:15:03
问题 I'm having issues in figuring out the best design that fits my needs regarding a Role based authorizations using Identity in a .NET Core 2.1 project. I already extended the User class from Identity with an ApplicationUser class. I need 5 different roles to control the access to the different features of the app : Admin, Teacher, Student, Parent and Supervisor All the common attributes are kept in User and ApplicationUser but I still require different relationships to other tables depending of