asp.net-identity-2

ASP.Net Identity 2 Reset password with SMS

↘锁芯ラ 提交于 2019-12-04 19:38:48
问题 I'm looking to send the user an SMS when reseting their password. I already have the facilities to send a SMS, I just need a guide on how to set it up with Identity 2.0. I can't seem to find any useful info online, the reference code itself isn't properly commented either. I want to generate a security code, send it to the user, he must then input it into a form and then be allowed to reset his/her password. Can anyone direct me to a guide/tutorial that explains this process? 回答1: After

Asp.Net Identity and multiple login mechanisms

大城市里の小女人 提交于 2019-12-04 19:19:53
I'd like to create an application that would be as open as possible to different login mechanisms. So I've used Asp.Net Identity. For (almost) free, this system gives me: Simple accounts OpenID with Facebook, Microsoft, Google and more If you use the other templates, you can also have Organisational Accounts with the following 3 options: Cloud - Single Organisation Cloud - Multiple Organisations On-Premises My use cases are showing that I need a mix of all of that: Users that want a simple account Users that want to connect with OpenID Companies that are using Office 365 and would like to SSO

OWIN AuthenticationOptions updating at runtime in mvc5 application

北慕城南 提交于 2019-12-04 16:53:10
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 -- AuthenticationOptions are set at the start of application and i did'n find any way to replace it at runtime. so,

Authorize and GetRoles doesn't work in ASP.NET Identity

大兔子大兔子 提交于 2019-12-04 16:36:22
I am using ASP.NET Identity 2.1.0 using Entity Framework implementation. Authentication works fine but role based security has problem. Although I've added role to the user but this code returns empty : var roles= UserManager.GetRoles(User.Identity.GetUserId()); Also Authorization based on roles of logged in user fails. when user redirects to a controller like below application redirects him to the login page. [Authorize(Roles = "Admin")] public abstract partial class AdminAreaController : Controller { In order to add ASP.NET Identity, first, I have created custom user class to add profile

Asp.Net Identity 2.0 Custom Storage Provider using Dapper

∥☆過路亽.° 提交于 2019-12-04 10:55:52
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 UserStore<TUser> : IUserLoginStore<TUser,int>, IUserClaimStore<TUser,int>, IUserRoleStore<TUser,int>,

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

懵懂的女人 提交于 2019-12-04 10:53:23
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<bool> CheckPasswordAsync(ApplicationUser user, string password) { return await Task.Run(() => {

exception after upgrade ASP.NET Identity to 2.0

夙愿已清 提交于 2019-12-04 10:45:30
问题 my project: VS2013, Entity Framework, Web forms, database first, Identity I updated all NuGet packages of my project today (2014-4-15). Among them, Identity is upgraded to 2.0.0.0. I thought things were going good, but unfortunately when I run the application, the following statement gives an exception. namespace xxx.Models { // You can add User data for the user by adding more properties to your User class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. public

ASP.NET Identity 2 Remember Me - User Is Being Logged Out

断了今生、忘了曾经 提交于 2019-12-04 10:36:44
问题 I am using Identity 2.1 in my MVC5 app. I am setting the isPersistent property of the PasswordSignInAsync to true to enable 'Remember Me': var result = await SignInManager.PasswordSignInAsync(model.Username, model.Password, true, shouldLockout: false); But if I stay logged in overnight, then when I refresh the page in the morning, it logs me out and I have to sign in again. How do I prevent automatic logging out until the user manually logs out? Is it something to do with the Cookie

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

心已入冬 提交于 2019-12-04 06:41:13
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.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return

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

最后都变了- 提交于 2019-12-04 05:52:04
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() in a web api controller as Guid ? public class GuidUserLogin : IdentityUserLogin<Guid> { } public class