asp.net-identity-2

UserManager Keeps throwing a System.ArgumentNullException

亡梦爱人 提交于 2019-12-10 12:45:55
问题 I am trying to implemented the standard Id in AspNetUsers from nvarchar to int . I've manage to get that side working. However my issue is when I try to login I keep getting an error from the UserManager class. My code is below: public class UserManager : UserManager<ApplicationUser, int> { public UserManager(IUserStore<ApplicationUser, int> store) : base(store) { } And on the login page I've got if (IsValid) { // Validate the user password var manager = Context.GetOwinContext()

UserManager always null in ASPNET Identity 2 app

☆樱花仙子☆ 提交于 2019-12-10 12:32:16
问题 Setup: I have an MVC 5 app with a number of library projects, created using my own exported templates. The exported templates have been working fine. I am using ASPNET Identity. I am just using a copy of the Microsoft Aspnet Identity Sample as supplied in the relevant NuGet package, that I have woven into my exported templates. This has been working fine. I have not touched the files supplied in the ASPNET Identity 2 sample. The error happens in the IdentityConfig.cs file. For some reason, it

ASP.Net Identity 2 login using password from SMS - not using two-factor authentication

牧云@^-^@ 提交于 2019-12-10 11:34:08
问题 Following blog series by @Taiseer Joudeh (http://bitoftech.net/2015/01/21/asp-net-identity-2-with-asp-net-web-api-2-accounts-management/) I've build simple WebApi with JWT authentication. I'm able to login and query my endpoint using token. I'm trying to change how my login mechanism works. Right now user must send his login and password to /oauth/token to get access token that will be send with every request to webapi. I'd like to be able to login user with password that will be send via SMS

ASP.NET Identity 2 - injecting ISecureDataFormat<>

对着背影说爱祢 提交于 2019-12-10 11:19:28
问题 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

Can send emails through Gmail account only if account has “Access for less secure apps” enabled

大城市里の小女人 提交于 2019-12-09 15:52:10
问题 If my Gmail account has Access for less secure apps disabled , then my application can't send emails through this account . Instead I get " The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required " exception. Here Google explains that by disabling Access for less secure apps , only apps that use modern security standards can sign in . What are those modern security standards my code needs to implement and can you

How to get ApplicationDbContext out of the Owin pipeline

强颜欢笑 提交于 2019-12-09 14:48:09
问题 This has to be simple, but I'm going bug-eyed trying to find the answer. How does a controller action get a reference to the per-request ApplicationDbContext that was stashed in the Owin pipeline? EDIT: Ok, I think I'm getting closer... or maybe not... All of my Googling seems to lead to this blog post, which sez to use: var dbContext = context.Get<ApplicationDbContext>(); where context is apparently an instance of Microsoft.Owin.IOwinContext . So I tried: var db = HttpContext.GetOwinContext(

How to Use AspNet.Identity core in My Sql database

我们两清 提交于 2019-12-09 04:50:22
问题 I am developing one application using asp dot net core 2 using MySql database .Please help me How can i use Asp Net Identity in MySqlDatabase . 回答1: I had to do this for a client. And I did in an application with ASP.NET Core 1.0, but for curiosity I also tried for an application in .NET Core 2.0. What I did was first install the Entity Framework MySQL package from https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/ using package manager console. After that I changed in the

ASP.Net Identity 2 login using password from SMS - not using two-factor authentication

假装没事ソ 提交于 2019-12-08 22:40:38
Following blog series by @Taiseer Joudeh ( http://bitoftech.net/2015/01/21/asp-net-identity-2-with-asp-net-web-api-2-accounts-management/ ) I've build simple WebApi with JWT authentication. I'm able to login and query my endpoint using token. I'm trying to change how my login mechanism works. Right now user must send his login and password to /oauth/token to get access token that will be send with every request to webapi. I'd like to be able to login user with password that will be send via SMS to phone number assigned to his account. It should require two requests to token endpoint path.

ASP.Net Identity 2, Two Factor Security Code timespan

走远了吗. 提交于 2019-12-08 21:08:28
问题 We are using 2FA with ASP.Net Identity 2 via email. This works fine most of the time but in some cases there are delays with the security code getting through to users email, the 6-minute window for the security code then becomes too short. Is there a way of adjusting this time window for the 2FA code? 回答1: I think you have to change the validity-timespan in the UserTokenProvider . Try the following in your UserManager<TApplicationUser> implementation: public static ApplicationUserManager

Get password from a user with UserManager

[亡魂溺海] 提交于 2019-12-08 12:25:21
问题 I'm making a website with MVC5 ASP.NET. I'm using Identity framework 2.0 implement class with properties such as passwordhash, username, email, emailconfirmed and so on. I'm using userManager.ChangePassword(user.Id, Oldpassword, Newpassword);, but i can't figure out how i should get a password from a user as plain text (string) [HttpPost] public ActionResult ChangePassword(AspNetUsersViewModel userView) { UserManager<IdentityUser> userManager = new UserManager<IdentityUser>(new UserStore