asp.net-identity

Asp.Net MVC5 How to ensure that a cookie exists?

限于喜欢 提交于 2019-12-03 15:04:30
问题 I'm new to MVC (5). In order to add localization support to my website I added a " Language " field to my ApplicationUser : IdentityUser What's the best approach to now store this information in the browser and ensure that it gets re-created even if the user manually deletes it? TL; but I've got time What I've tried until now: I started creating a cookie in my method private async Task SignInAsync(ApplicationUser user, bool isPersistent) but I notice that: This method is not used if the user

Relation to users when these are stored in an external Identity provider service

时光总嘲笑我的痴心妄想 提交于 2019-12-03 14:58:56
I'm trying to create an API and a website client for it. Lately I've been reading a lot about OAuth2 as a security mechanism and companies that offers authentication as a service such as auth0.com or even Azure active Directory and I can see the advantages in using them Because I'm used to always having the users in the same database and tables with relationships to the Users table in the form of One to Many such as below public class User { public string subjectId { get; set; } public virtual List<Invoice> Invoices { get; set; } /* More properties in here */ } public class Invoice { public

ASP.NET MVC 5 identity application user as foreign key

牧云@^-^@ 提交于 2019-12-03 14:58:37
I know Visual Studio 2013 launches officially tomorrow and hopefully there will be more accompanying documentation especially as it regards ASP.NET Identity. I am hopping that in the meantime someone can help me out. All I am trying to do is to get the UserID of the currently logged in user as foreign key to a table I called Retailer. First here is the error message I am getting An entity object cannot be referenced by multiple instances of IEntityChangeTracker. Here is my POCO : public class Retailer { [Key] public int RetailerId { get; set; } public string BusinessName { get; set; } public

Identity Provider and Unity Dependency Injection

牧云@^-^@ 提交于 2019-12-03 14:35:25
问题 I have downloaded this sample in which I can try the features of Identity Provider in ASP.NET MVC 5: http://www.nuget.org/packages/Microsoft.AspNet.Identity.Samples I have used many times Unity DI for my repositories, services, unit of work and other stuff without problems. But now, when I install Unity DI, I have many problems with the Interfaces and DI that uses the Identity Provider. I just have downloaded the code of the example and I have configured the Unity DI, but I don't want to use

Asp .Net Identity 2 - Logging out other sessions (using security stamp) after password update also logs out current session

核能气质少年 提交于 2019-12-03 14:20:00
I need to immediately invalidate and log out any other logged in sessions when a user changes their password, but allow the active session (who has just updated their password) to remain logged in. To do this, I'm using the UpdateSecurityStampAsync(currentUser.Id); method on the UserManager. All other sessions are successfully logged out, but the active session is also logged out despite the call to SignInAsync after updating the security stamp. The Identity configuration I'm using is as follows: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType =

Implementing custom claim with extended MVC Core Identity user

若如初见. 提交于 2019-12-03 14:14:22
How can I create a custom authorize claim in MVC Core 2.0 (using AspNetCore.identity) to verify a custom user boolean property? I have extended the IdentityUser (ApplicationUser) to include a boolean value "IsDeveloper". I am using claims based authentication and would like to add a custom claim, but am not certain where to start. How can I create a custom claim that will: Find the current (customized) Core.Identity user. Evaluate the a custom identity user bool value? I understand the core identity claims MSDN: Claims Based Authentication , but am new to custom claims, so I am not sure where

.Net Core JWT Authentication with custom API Key Middleware

て烟熏妆下的殇ゞ 提交于 2019-12-03 14:12:57
I have a .Net Core 2.0 application that uses JWT tokens to authorize the user. This all works fine but I want to have some sort of API Key mechanism to allow other applications to integrate but I cannot seem to get this to work with the current authentication. Code: Startup.cs public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IMemoryCache cache, IServiceProvider serviceProvider) { app.UseAuthentication(); ApiKeyMiddlewear(app, serviceProvider); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index

Identity Server 4 + Identity Framework + React front-end

老子叫甜甜 提交于 2019-12-03 14:00:50
问题 I'm looking for advice on how to properly put an environment like this together. There's a ton of info out there and a ton of material to cover in the Quickstarts, but I'm still feeling fairly lost after 3 days of trial-and-error. I'm familiar w/ Identity Framework in the .NET Framework, but have never worked with Identity Server prior to this. We've got a microservices setup built on Node and MySql...a series of services in Docker containers which talk to their own db nodes in a MySql

Where is the information about the authorization token stored on the ASP.NET WEB API server?

天大地大妈咪最大 提交于 2019-12-03 13:49:06
问题 In my Web Api 2 Identity 2 application after user registration I have a single record in single table: AspNetUsers. I use the following http request to get token: POST https://localhost:44304/Token HTTP/1.1 Accept: application/json Content-type: application/x-www-form-urlencoded Accept-Encoding: gzip Content-Length: 68 Host: localhost:44304 Connection: Keep-Alive User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4) grant_type=password&username=somemail@gmail.com&password=123456 and I get the

Setting up Forms Authentication for multiple Web Apps in MVC 5 based on OWIN

吃可爱长大的小学妹 提交于 2019-12-03 13:43:07
问题 I am in process of setting up my 1st MVC Web App. I know I need to provide a Forms Based Authentication model as well as I know I will be reusing it for multiple other internal web apps as well. All the documentation for MVC 5 Authentication, which I believe is all based on OWIN stuff, have it "baked" into a single web app using EF Code First no less. What I am trying is to have an another Web App that I strip everything out of except for the Account stuff and then try to "point" my web apps