asp.net-identity

.NET Core Identity. Use one context or two?

爱⌒轻易说出口 提交于 2021-01-28 12:11:56
问题 I am struggling with a basic problem. Keep my ASP.NET Core Identity context separate from my business context or combine the two. Philosophically, it seems good to keep them separate. If I want to upgrade .NET Core at some point in the future, I have fewer issues if my identity context is separate. Practically, it seems like a good idea to combine them. Otherwise, I am creating another user table or doing some weird workarounds to get user information from navigation properties. How do you

Get role list with associated users in ASP.NET Identity

随声附和 提交于 2021-01-28 05:22:40
问题 I have a role. How can I find the list of users which have that role? public ViewResult Index() { return View(roleManager.RoleList.ToList()); } In this method I take the list of roles there have the user's UsersId . Now how to link it with my UserModel to take the UserName ? I am not so good in the LINQ, and can't find a good idea In the result I want to make a table in the view foreach (RoleModel role in Model) { <tr> <td>@role.Id</td> <td>@role.Name</td> <td>@role.Description</td> <td> @if

Use One Identity for WebAPI and Asp.Net Core In different projects

六月ゝ 毕业季﹏ 提交于 2021-01-28 03:25:49
问题 I have a solution that contains 2 dot net core projects : Web API Web Application(MVC) The web application is a web API consumer. My web application controller will use httpclient for getting data and I use razor for the client (no Javascript library such as Angular). I want to use Microsoft identity for authentication and recently I have read about JWT . In which project should I add Microsoft Identity? (Because we need authentication for building a token in JWT ) If I must add it in the Web

How to use IdentityServer4 with Custom password validation with ASP.NET Microsoft Identity

混江龙づ霸主 提交于 2021-01-27 05:52:50
问题 I am working with IdentityServer4 and using ASP.NET Identity, and would like to do custom password validation so that I can add validation for password expiration (such as if password is older than 90 days then make the user change the password, etc...). I ran across the method .AddPasswordValidator<> when setting the services.AddIdentity in the ConfigureServices() method of the Startup.cs, but am unable to find any clear documentation on how to implement it. Can anyone help with

No AccountController for asp.net core 2.1

纵然是瞬间 提交于 2021-01-27 02:16:32
问题 I realise in asp.net core 2.1 Identity has been shifted, but can be added to the solution if you add them as a scaffolded item. It adds all the razor class library for all the pages. However what I want to do is have the old AccountController way where a client (mobile or web) can post to the account related API's.. What are my options for being able to get the old way back or similar. so that i can use api's from clients 回答1: Unfortunately, it doesn't exist any more. I was personally very

Add claims in token from web api

柔情痞子 提交于 2020-12-30 03:46:58
问题 I'm working on a project using IdentityServer4 and Identity and an API. The API is protected with IDS4. The API and IDS4 are on the same project, so I have 3 projects in my solutions: - A MVC web project that contains the IdentityServer and the API - An implementation of Identity that use MongoDB as database provider - A console application that simulate the client My client authenticate with IDS4, get the access_token and then call the api with the token. This part is working fine. Now i'm

Add claims in token from web api

风格不统一 提交于 2020-12-30 03:46:06
问题 I'm working on a project using IdentityServer4 and Identity and an API. The API is protected with IDS4. The API and IDS4 are on the same project, so I have 3 projects in my solutions: - A MVC web project that contains the IdentityServer and the API - An implementation of Identity that use MongoDB as database provider - A console application that simulate the client My client authenticate with IDS4, get the access_token and then call the api with the token. This part is working fine. Now i'm

Identity 3 SignInManager.PasswordSignInAsync() doesn't return any result

大憨熊 提交于 2020-12-29 13:13:47
问题 I am creating web application with Identity 3.0 and have problems with SignInManager PasswordSignInAsync() method. I'm using it just like in documentation, but it doesn't return anything ( application code just stop there ) Here`s my controller code: public class AppController : Controller { private IAccountService _service; private readonly SignInManager<User> _signInManager; private UserManager<User> _userManager; public AppController(IAccountService service, SignInManager<User>

Identity 3 SignInManager.PasswordSignInAsync() doesn't return any result

三世轮回 提交于 2020-12-29 13:13:26
问题 I am creating web application with Identity 3.0 and have problems with SignInManager PasswordSignInAsync() method. I'm using it just like in documentation, but it doesn't return anything ( application code just stop there ) Here`s my controller code: public class AppController : Controller { private IAccountService _service; private readonly SignInManager<User> _signInManager; private UserManager<User> _userManager; public AppController(IAccountService service, SignInManager<User>

Identity 3 SignInManager.PasswordSignInAsync() doesn't return any result

蹲街弑〆低调 提交于 2020-12-29 13:11:52
问题 I am creating web application with Identity 3.0 and have problems with SignInManager PasswordSignInAsync() method. I'm using it just like in documentation, but it doesn't return anything ( application code just stop there ) Here`s my controller code: public class AppController : Controller { private IAccountService _service; private readonly SignInManager<User> _signInManager; private UserManager<User> _userManager; public AppController(IAccountService service, SignInManager<User>