asp.net-identity-2

OWIN AuthenticationOptions updating at runtime in mvc5 application

北战南征 提交于 2019-12-06 10:01:20
问题 Hi! Here is the situation: I have one MVC5 application with Identity2 on iis7 wich serves multiple web sites. host name is the key for certain web site. site.com, anothersite.com and so on i've decided to use external login with google on all my sites and every site should be google client with personal clientid and clientsecret. for example: site.com - clientid=123123, clientsecret=xxxaaabbb anothersite.com - clientid=890890, clientsecret=zzzqqqeee but there is a little problem --

Why can't users authenticate after deploying locally the ASP.NET 4.6 application to the IIS 10 server?

帅比萌擦擦* 提交于 2019-12-06 07:22:46
In my ASP.NET Web Forms application I am using ASP.NET Identity 2.2 for the membership system. The Development stage works as expected. Users get authenticated and have access to different areas of the website according to their roles. After the deployment to the IIS 10 local server the authentication is overturned. The login is successful and, yet, the user does not authenticate. The Login page loads once again empty and fresh. I know that the login is successful through some test I've made with a literal created right before the redirect. This is the Login method: protected void LogIn(object

Asp.Net Identity 2.0 Custom Storage Provider using Dapper

谁都会走 提交于 2019-12-06 06:09:01
问题 I know this description is a bit lengthy, but its easy to follow. I have created a custom storage provider which uses Dapper as a replacement for Entity Framework. To do so I've created a class library called AspNet.Identity.Dapper. The Web app simply adds a reference to this class library to replace EF. Inside the class library is this code: In creating the custom provider I implemented my own UserStore. The UserStore implements all the interfaces. Here is the definition: public class

Duplicate Role Names on Asp.Net Identity and Multi-tenancy

只愿长相守 提交于 2019-12-06 06:01:10
I'm developing a Multi-tenancy web application with ASP.Net MVC and Identity 2.0. I have extended the IdentityRole like this: public class ApplicationRole : IdentityRole { public ApplicationRole() : base() { } public ApplicationRole(string name) : base(name) { } public string TenantId { get; set; } } This because each Tenant will have individual sets of roles, like "Admin", "Staff", etc. But the problem is, when I add a new Role, if the "Tenant A" has "Admin" role, when I add to "Tenant B" the "Admin" role, I get an IdentityResult error because "Admin" name is taken... Its is kinda obvious

ASP.NET Identity 2 - injecting ISecureDataFormat<>

ぃ、小莉子 提交于 2019-12-06 05:10:26
I'm having same issue described here with no answer, just using Unity. I'm trying to register ISecureDataFormat<> in the lastest VS2013 (update 2) SPA/Web Api template. I've tried container.RegisterType(typeof(ISecureDataFormat<>), typeof(SecureDataFormat<>)); container.RegisterType<ISecureDataFormat<AuthenticationTicket>, SecureDataFormat<AuthenticationTicket>>(); container.RegisterType<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>(); It "works" but not really because then it complains about the next depenedency in that tree, IDataSerializer... and then the next IDataProtector,

Build a custom user check password in Asp.Net Identity 2

家住魔仙堡 提交于 2019-12-06 04:59:09
问题 I need to build a custom user password check in an application implemented in asp.net MVC 5 and using Asp.Net Identity 2. I read in a stackoverflow post (Writing a custom IUserPasswordStore and SignInManager.PasswordSignInAsync in Identity 2.1) that I only need to override the CheckPasswordAsync method in UserManager. I try to override this method in IdentityConfig.cs file. Here is the code that I add to the ApplicationUserManager class just for test this solution: public override async Task

using aspnet identity with custom tables

我的未来我决定 提交于 2019-12-06 02:57:48
I am working on asp.net MVC core application. I have custom database with users and roles tables. I want to use asp.net identity with custom tables so that I don't have to use aspnetusers, aspnet roles tables. How to do it with asp.net identity and asp.net core Good luck with that! :) I have just gone through that process last few days. I've got it to work but its really painful at some stages. In short: You need to create your own user model that implements IUser interface. You need to create your own DAL that gets data from your custom db tables You need to implement your own UserStore that

How to Add another Propertys to User.Identity From table AspNetUsers in identity 2.2.1

喜欢而已 提交于 2019-12-06 01:08:44
问题 i Add some new property to asp.net identity 2.2.1 (AspNetUsers table) code first public class ApplicationUser : IdentityUser { public string AccessToken { get; set; } public string FullName { get; set; } public string ProfilePicture { get; set; } public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager

After Identity Custom User , User.Identity.GetUserId() returns wrong type as string

孤者浪人 提交于 2019-12-06 00:20:10
问题 I created custom User model for entity framework and asp.net identity. I checked other answers in here, they are close to my question but answers not apply my requirement. so i am asking here. Everything is ok. But when i try to get user id like : ApplicationUser user = await manager.FindByIdAsync(User.Identity.GetUserId()); User.Identity.GetUserId() return string. I configured it like Guid. But it returns string :( My classes are here. Please help me, how can i get User.Identity.GetUserId()

Places you can add password validation in MVC?

自闭症网瘾萝莉.ら 提交于 2019-12-05 22:35:59
I've got a "ForceChangePassword" page for after "ForgotPassword" and it is randomly throwing two length requirements on the "NewPassword" field. The problem is, I never added a length requirement of 7 and have no idea where it is coming from or how to change it. Errors from ModelState The New password must be at least 6 characters long. The 'New password' field is an invalid password. Password must have 7 or more characters. if (!ModelState.IsValid) { return View(model); } // Only line executed in the POST Action. I set the length requirement to 6 on the ViewModel via Attribute (see below). I