asp.net-identity

identity server 4 windows authentication

和自甴很熟 提交于 2019-12-22 17:53:02
问题 I have followed a combination of these three resources for getting started with Identity Server 4. IdentityServer4.Quickstart.UI 4_ImplicitFlowAuthenticationWithExternal Combined_AspNetIdentity_and_EntityFrameworkStorage The combination of the three were used in order to store users within the the database even from external providers. Also store Identity Server 4 configurations such as claims, roles, clients, and resources. My main issue right now is when running in IIS Express windows

User.IsInRole failing after migrating SimpleMembership database to Identity 2

不想你离开。 提交于 2019-12-22 13:31:39
问题 I successfully updated my application from MVC4-EF5 to MVC5-EF6. I then migrated my database from Simplemebership to Identity 2.0. I can login but User.IsInRole always returns false. All the proper tables AspNetUsers, AspNetRoles, AspNetUserRoles, AspNetLogins and AspNetClaims have been created, the spelling and type of all columns are correct and they have been populated with the data from the SimpleMembership tables (which have been deleted). I have a user "MyUser" which is Id = 2 in the

Is SessionSecurityToken lifeTime the same as sessionTokenRequirement lifetime?

牧云@^-^@ 提交于 2019-12-22 12:38:33
问题 I'm migrating forms authentication in webforms across to Microsoft Identity. When creating a SessionSecurityToken using a ClaimsPrincipal cp object, I have this code: Dim token As New SessionSecurityToken(cp, TimeSpan.FromMinutes(30)) However, in web.config I also see this: <configSections> <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

Invalid object name 'dbo.AspNetUsers'

梦想与她 提交于 2019-12-22 12:37:56
问题 I have an MVC5 application using Entity Framework 6.1 and Asp.Net Identity 2 and have data migrations enabled. I have used sample code from other answers on StackExchange to seed the Role and User tables. My application data context is based on IdentityDbContext. On issuing an update-database command, my database is created and populated with the following tables: My app launches OK, but when I try to log in using the seeded user (or any user for that matter), I get the following error: How

ASP.Net Identity change Password Hashing method [duplicate]

☆樱花仙子☆ 提交于 2019-12-22 09:48:18
问题 This question already has answers here : How do I generate an encryption hash in ASP.NET MVC? (4 answers) Closed 3 years ago . I'm developing an MVC 5 web application with an existing database. I'm also using ASP.Net Identity for my Authorisation and Authentication but in database passwords are not Hashed using Identitys default password hasher, i need to change it with my own hasher. any idea? 回答1: After creating UserManager instance, you need to assign the passwordhasher property to your

AddToRole() returns “User name can only contain letters or digits” only when users email address contains a dash

做~自己de王妃 提交于 2019-12-22 09:21:51
问题 I'm using Asp.Net Identity 2.0, configured so that the users' email address is also the username, so in IdentityConfig I have set AllowOnlyAlphanumericUserNames = false in the ApplicationUserManager constructor: public class ApplicationUserManager : UserManager<ApplicationUser> { public ApplicationUserManager(IUserStore<ApplicationUser> store) : base(store) { } public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) { var

Move ASP.NET Identity store to EF Sql database

久未见 提交于 2019-12-22 08:58:08
问题 By default ASP.NET Identity user data is stored in an mdf file. I want to store the data in a Sql database so that I changed the defaultconnection string in my web.config to my EF based connection: <add name="DefaultConnection" connectionString="metadata=res://*/Models.StartifyModel.csdl|res://*/Models.StartifyModel.ssdl|res://*/Models.StartifyModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MYPC\SQLEXPRESS;initial catalog=mydb;integrated security=True

ASP.NET core Web API Authorize Attribute return 404 Error & force redirect

家住魔仙堡 提交于 2019-12-22 08:26:10
问题 I have asp.net core 2.0 solution which contains following projects: Data: a class library for EF code OAuth: as web application project for IdentityServer4 code Api: for my API created as empty web project Now the OAuth project is configured with aspnetidentity and its working fine, I able to get the token after authentication, and this is the startup code for it: public void ConfigureServices(IServiceCollection services) { // connect with normal database services.AddDbContext<MCareContext>

ASP.NET Core Identity 3 Cookie timeout

本小妞迷上赌 提交于 2019-12-22 07:57:51
问题 I have a weird issue happening with RC2. I have setup Identity 3 ExpireTimeSpan to 12 hours using the following configuration option options.Cookies.ApplicationCookie.ExpireTimeSpan = new TimeSpan(12,0,0); After logging in to the website and leaving it untouched for ~35-40mins, I get a 401 error (for my ajax post calls) and refreshing the website, I get back to the login page. Why do I have to reauthenticate when I have setup the ExpireTimeSpan to 12hours? Is there another setting or

The type IUserStore`1 does not have an accessible constructor

谁都会走 提交于 2019-12-22 06:52:19
问题 I want to setup MVC5 application with Unity 3. I created a default web mvc5 application from a standard template then add unity When I am accessing the Register action in AccountController I get the following exception: The type IUserStore`1 does not have an accessible constructor. from this post How to add MVC 5 authentication to Unity IoC? I know the problem is that Unity selects the constructor with longer parameter list. The solution is to register the Account controller to be used with