asp.net-identity

.NET Core Web API key

让人想犯罪 __ 提交于 2020-01-31 02:59:28
问题 I am developing an application that users can authenticate via username and password and we provide a JWT token that then gets validated on the server. One thing I would like to add is the ability to have a special API Key (guid) that the users can use when integrating with this application instead of using a username and password. I am unsure how to do this since the authentication part seems to be a bit of a black box (using Aspnet Identity). Here is some of my code for the authentication

.NET Core Web API key

风流意气都作罢 提交于 2020-01-31 02:59:09
问题 I am developing an application that users can authenticate via username and password and we provide a JWT token that then gets validated on the server. One thing I would like to add is the ability to have a special API Key (guid) that the users can use when integrating with this application instead of using a username and password. I am unsure how to do this since the authentication part seems to be a bit of a black box (using Aspnet Identity). Here is some of my code for the authentication

How to configure ASP.NET Identity ApplicationUserManager with StructureMap

醉酒当歌 提交于 2020-01-29 04:48:05
问题 I am using asp.net identity in my project and using structuremap as DI framework. the problem is when i use constructor injection then ApplicationUserManager not configured all of it's members e.g TokenProvider, ... this is my ApplicationUserManager class: public class ApplicationUserManager : UserManager<User, long> { public ApplicationUserManager(IUserStore<User, long> store) : base(store) { } public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options

Understanding Microsoft Identity Namespaces (System.Web.Security, Microsoft.AspNet.Identity.Core, vs Microsoft.AspNetCore.Identity)

三世轮回 提交于 2020-01-24 22:10:05
问题 i hope somebody had a similar problem and can give be advice. I researched for quite some time but couldn't find a definitive answer. My Set Up: 1 MsSQL Database (contains the Identity Tables of System.Web.Security) Many DLLs in .Net Framework (Using System.Web.Security for Log-In) Multiple different Programs/Apps calling the DLLs WebForms GUI in .Net Framework (Using System.Web.Security for Log-In) What I want: Use IdentityServer4 in .net Core or .Net Framework Keep DLLs in .Net Framework

Aspnet core Identity custom ApiAuthorizationDbContext

不想你离开。 提交于 2020-01-24 16:39:24
问题 I'm working with aspnet core 3.0 with angular project. I see this new ApiAuthorizationDbContext and I wanted to override the table name and user id (to int) but there is no way I can do it. Does any body know a trick? This is the class for the context where I tell him to override the table name but it create AspNetUser and User table ! why doesn't just create one as usual public class ApplicationDbContext : ApiAuthorizationDbContext<AppUser> { public ApplicationDbContext( DbContextOptions

custom asp.net identity store - why is HttpContext.Current empty at times

心已入冬 提交于 2020-01-24 12:05:29
问题 I've implemented a custom User Store for ASP.NET Identity by following the example set here. That all works fine, except for this: I need access to data about the currently logged in user in my user store. Normally, you'd access that by accessing HttpContext.Current.User Now, once auser has logged in, if he user then goes to the Manage controller (e.g. to try and change his/her password), when ASP.NET identity looks up the user again by calling CustomUserManager.FindByIdAsync(string userId)

custom asp.net identity store - why is HttpContext.Current empty at times

北城以北 提交于 2020-01-24 12:05:16
问题 I've implemented a custom User Store for ASP.NET Identity by following the example set here. That all works fine, except for this: I need access to data about the currently logged in user in my user store. Normally, you'd access that by accessing HttpContext.Current.User Now, once auser has logged in, if he user then goes to the Manage controller (e.g. to try and change his/her password), when ASP.NET identity looks up the user again by calling CustomUserManager.FindByIdAsync(string userId)

Error on installing ASP.NET Identity 2 Samples

走远了吗. 提交于 2020-01-24 03:44:05
问题 I'm trying to install ASP.NET Identity 2 samples project. I open Visual Studio 2013, create an empty ASP.NET project, open Package Manager Console and type: Install-Package Microsoft.AspNet.Identity.Samples -Pre After some time of installing it returns an error: Unable to uninstall 'jQuery 1.10.2' because 'bootstrap 3.0.0' depends on it. Ok, I type the installation command again. This time the error is: Failed to add reference to 'System.Net.Http'. Please make sure that it is in the Global

How to force expire a JWT token in ASP.Net Core?

帅比萌擦擦* 提交于 2020-01-23 17:10:05
问题 I have implemented a JWT authentication and a policy-based authorization in ASP.NET Core. There is a certain user with admin privileges who can assign permissions to non-admin users. If the admin updates the permissions/claims of a non-admin user, is there a way to force expire the access token so that user carrying it will be forced to request a new access token with the newly updated permissions/claims? Right now, the only way to that is to wait for the token to expire but I want to force

ASP.NET Core Identity 2: User.IsInRole always returns false

与世无争的帅哥 提交于 2020-01-23 06:52:48
问题 The question: I call RoleManager.CreateAsync() and RoleManager.AddClaimAsync() to create roles and associated role claims. Then I call UserManager.AddToRoleAsync() to add users to those roles. But when the user logs in, neither the roles nor the associated claims show up in the ClaimsPrincipal (i.e. the Controller's User object). The upshot of this is that User.IsInRole() always returns false, and the collection of Claims returned by User.Claims doesn't contain the role claims, and the