asp.net-identity

How can keep the user logged in even after the browser has closed with Identity ASP.NET MVC framework?

回眸只為那壹抹淺笑 提交于 2019-12-11 07:05:58
问题 Currently, each time the user browser closes, he/she will have to login again. When they login, this is the code that I use to sign them in Identity. SignInManager.SignIn(user, false, false); Here is how my Authentication is configured today public void ConfigureAuth(IAppBuilder app) { app.CreatePerOwinContext(ApplicationDbContext.Create); app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); app.CreatePerOwinContext<ApplicationSignInManager>

The entity type ApplicationUser is not part of the model for the current context, DB First with custom user store

时间秒杀一切 提交于 2019-12-11 06:57:10
问题 So I'm building an application on top of an existing database to which I have limited rights to change (the idea is to make as few changes to the DB schema as possible). This is an MVC 5 application attempting to use the Identity system with a custom user store to a MySQL database. Problem: I'm getting the following exception when attempting to register a user via the auto-generated AccountController in the register method: IdentityResult result = await UserManager.CreateAsync(user, model

ResetPasswordAsync returns 'Invalid Token' when token is generated inside a WebJob

烂漫一生 提交于 2019-12-11 06:47:23
问题 I have a scheduled WebJob that runs on daily basis and checks the password expiry date for all users in my database. If the password expiry date is today, it will generate a password reset token and send it to the user via email. Then user clicks the url in the email and is brought to a website, where they input the new password. I managed to generate a token in my WebJob and send it over via email. However, when resetting the password through my Asp.NET Website I get Invalid Token . I cannot

Session Timeout when using IdentityServer4 and Oidc client causing Silent Renew to stop working

故事扮演 提交于 2019-12-11 06:14:53
问题 I am currently involved in development of an Angular4 SPA application connected to a .NET CORE 1.1 WebApi using IdentityServer4 as it's authentication service. On the Angular side we are using the Oidc client from Damien Bod 1.2.1 - https://github.com/damienbod/angular-auth-oidc-client. We have managed to successfully setup and login via IdentityServer. The problem arises that are exactly 30min we are getting a SessionTimeout on the IdentityServer and from there the Oidc client obtains a 401

Can I use claims data to insert CreatedBy user data into custom tables?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 05:54:07
问题 I have slight architecture issue. I have IdentityServer solution, to authenticate user with Identity user store(with user in database). I have login functionality here and register functionality, so I have to use DbContext here. I have another solution API where I hold custom tables which are not Identity tables. All tables are in same database. Now when I add new record through API, I somehow want to connect CreadetBy with Identity user. I know I can get info about user from Claims, and then

Two authentication cookies in ASP.NET Core Identity

微笑、不失礼 提交于 2019-12-11 05:47:25
问题 Let's suppose we have a web-site where there are: Admin section Client section Guest(visitor) section Obviously, the last one (Guest section) can be accessed by everyone while admin part - only by administrations and client part - only by registered clients. Admins and clients have different model classes (Admin and User correspondingly), are stored in the different databases and we would like to use different authentication cookies for each of them. Is it possible to do with ASP.NET Core

What's the user parameter to PasswordHasher's methods used for?

大憨熊 提交于 2019-12-11 05:33:30
问题 In the non-Core version of Identity, PasswordHasher is a non-generic type. Its HashPassword method takes a single argument (the password to hash), and its VerifyHashedPassword method takes only two (the password hash generated previously by HashPassword , and the provided password to verify. This is great, because it means that I can use PasswordHasher without going all-in and using the whole Identity framework. In Microsoft.AspNetCore.Identity , on the other hand, PasswordHasher<TUser> is

How to rewrite the OWIN-Cookie manually (MVC5)

我是研究僧i 提交于 2019-12-11 05:29:59
问题 I use the IUserSecurityStampStore to implement sign-out-everywhere functionality. It seems to work fine, however I have the problem that every time the user changes her password, she is logged off afterwards. One possibility to work around this issue, is to call SignIn in the Manage -Action of the AccountController after a password change. This seems to work, but I think it’s a bit clumsy and probably not the right way. Thats why my questions are: How can I force OWIN to rewrite the cookie

moving mvc5 account controller code to separate project

不问归期 提交于 2019-12-11 05:27:57
问题 I have a solution that contains a WebApi2,MVC5 & DAL project (all RTM). I am wanting to use the new membership bits that are now baked-in, but I don't like all the account stuff being all in the account controller. Doing a file new project (asp.net) has all of the membership stuff coupled to the account controller. Within my DAL I am using EF6 as I like the ideal of code-first as it suits what I am trying to do. I am trying to take the account controller code and move it into my separate

The entity type IdentityUser is not part of the model for the current context in ASP.NET Identity

徘徊边缘 提交于 2019-12-11 04:37:49
问题 I want to check if there is a user with particular username and password in ASP.NET Identity. I tried and that is my code: UserManager<IdentityUser> userManager = new UserManager<IdentityUser>(new UserStore<IdentityUser>(new ApplicationDbContext())); var user = await userManager.FindAsync(userName, password); However, something goes wrong and that is the error: The entity type IdentityUser is not part of the model for the current context. Would you tell me a solution? 回答1: If you are using