asp.net-identity-3

What is the equivalent for IIdentityMessageService on ASP.NET Identity 3.0?

℡╲_俬逩灬. 提交于 2019-12-23 15:44:57
问题 On ASP.NET Identity 2.X we could configure a notification infrastructure trhough the IIdentityMessageService interface available at the Microsoft.AspNet.Identity.Core library, which was not upgraded to version 3.0. What are the practices for configuring messaging infrastructure on ASP.NET Identity 3.0? 回答1: It seems that there is no more email service plugged to the Asp.Net Identity. You just define your own interface. The role of ASP.NET identity is to generate and validate the e-mail

Save user session in Redis with ASP.NET Core in Azure

微笑、不失礼 提交于 2019-12-22 07:58:24
问题 I'm using redis cache for saving some stuff in my project. I am using Azure (WebApp), and when I do a SWAP between my preproduction environment to production, the user session is lost and he need to relogin in my web page. I'm using Identity 3.0, with UseCookieAuthentication. I would like to store the "session" in Redis for solving my problem when I do the swap. I don't found information about it, any ideas? Thanks Startup.cs Code ConfigureServices: public void ConfigureServices

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

Checking login user AuthorizePolicy in Razor page on Asp.Net Core

╄→尐↘猪︶ㄣ 提交于 2019-12-22 01:51:05
问题 I'm looking for a variant of this @if (SignInManager.IsSignedIn(User) && User.IsInRole(Roles.Administrator)) { <div id="editArticle"> but instead of checking after the role I'm after a check into the policy much like you would in a controller by doing this. [Authorize(Policy = Policies.RequireAdmin)] 回答1: This seems similar to question asked here I found this link which may be helpful: https://docs.asp.net/en/latest/security/authorization/views.html Examples from that page: @if (await

'No database provider has been configured for this DbContext' on SignInManager.PasswordSignInAsync

强颜欢笑 提交于 2019-12-18 13:52:26
问题 .Net Core 1.0.0 - SDK Preview 2 (x64) .Net Core 1.0.0 - VS "15" Preview 2 (x64) .Net Core 1.0.0 - Runtime (x64) So, we updated an RC1 app to the latest versions above. After many hours of switching references, it's running. However, when logging in (AccountController/Login), I am getting an error at: public class AccountController : BaseController { public UserManager<ApplicationUser> UserManager { get; private set; } public SignInManager<ApplicationUser> SignInManager { get; private set; }

'No database provider has been configured for this DbContext' on SignInManager.PasswordSignInAsync

倖福魔咒の 提交于 2019-12-18 13:52:18
问题 .Net Core 1.0.0 - SDK Preview 2 (x64) .Net Core 1.0.0 - VS "15" Preview 2 (x64) .Net Core 1.0.0 - Runtime (x64) So, we updated an RC1 app to the latest versions above. After many hours of switching references, it's running. However, when logging in (AccountController/Login), I am getting an error at: public class AccountController : BaseController { public UserManager<ApplicationUser> UserManager { get; private set; } public SignInManager<ApplicationUser> SignInManager { get; private set; }

Why does this violate the type constraint?

给你一囗甜甜゛ 提交于 2019-12-17 16:18:29
问题 I'm trying to customise ASP.NET Identity 3 so that it uses integer keys: public class ApplicationUserLogin : IdentityUserLogin<int> { } public class ApplicationUserRole : IdentityUserRole<int> { } public class ApplicationUserClaim : IdentityUserClaim<int> { } public sealed class ApplicationRole : IdentityRole<int> { public ApplicationRole() { } public ApplicationRole(string name) { Name = name; } } public class ApplicationUserStore : UserStore<ApplicationUser, ApplicationRole,

How to set PasswordHasherCompatibilityMode.IdentityV3 in ASP.NET 5 Identity?

巧了我就是萌 提交于 2019-12-12 12:24:02
问题 Currently it seems default is set to PasswordHasherCompatibilityMode.IdentityV2 which is HMAC-SHA1 in ASP.NET 5. I tried to create a instance of PasswordHasherOptions to add to services (DI) but could not get it to work. V3 uses PBKDF2 with HMAC-SHA256, 128-bit salt, 256-bit subkey, 10000 iterations. I hope this would be as easy as some configuration setting in future rather than having to implement custom implementation since all the code is already there. Update: services.Configure

ASP.NET 5 Identity 3 users get signed out after application restart

人盡茶涼 提交于 2019-12-12 12:18:38
问题 We are using ASP.NET Identity 3. Our users are randomly getting signed out automatically. To reproduce this issue, I tried application restart, all users signed out, even those who had checked Remember me . It only happens in Production, works fine on development environment. Update: We have only one server in production. 回答1: You will need to configure data protection in the production server. I assume that in your local machine the website runs as a local user so the registry hives can be

ASP.NET Core Identity - Extending Password Hasher

余生长醉 提交于 2019-12-12 10:49:49
问题 I'm working towards moving an application from Web Forms to MVC and opted to go with MVC 6 using ASP.NET Core. In my current application I have a custom password hasher used with Identity. The implementation is very simple in my custom UserManager class: public ApplicationUserManager() : base(new UserStore<IdentityUser>(new AuthContext())) { this.PasswordHasher = new SqlPasswordHasher(); } I'm trying to do the same with .NET Core but the PasswordHasher property doesn't exist in UserManager. I