asp.net-identity-2

ASP.Net Identity 2 Reset password with SMS

核能气质少年 提交于 2019-12-03 12:55:05
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? After digging in the identity source code i found an alternative token provider that can generate tokens similar to

Get ASP.NET Identity Current User In View

旧街凉风 提交于 2019-12-03 12:44:46
问题 I use ASP.NET Identity 2.0 and MVC. I need to logged user's name,surname,email etc.. in view. How can get it? I can get just @User.Identity but there no my user class's property. //in my view, i need here my ApplicationUser class <div> @User.Identity.Name </div> //ApplicationUser class public class ApplicationUser : IdentityUser<int, CustomUserLogin, CustomUserRole, CustomUserClaim> { public ApplicationUser() { this.CreatedDate = DateTime.Now; } public DateTime CreatedDate { get; set; }

'Microsoft.Owin.IOwinContext' does not contain a definition for 'GetUserManager' and no extension method?

安稳与你 提交于 2019-12-03 10:52:56
问题 The following code is copied from the Asp.Net Identity 2.0 sample. private ApplicationUserManager _userManager; public ApplicationUserManager UserManager { get { return // Error _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); } private set { _userManager = value; } } However it gets the following error? Error 3 'Microsoft.Owin.IOwinContext' does not contain a definition for 'GetUserManager' and no extension method 'GetUserManager' accepting a first

How do I extend IdentityRole using Web API 2 + AspNet Identity 2

只谈情不闲聊 提交于 2019-12-03 10:16:10
问题 I am attempting to extend the AspNet IdentityRole class provided in the Web API 2 (With Individual Accounts) template in the latest version of Visual Studio 2013. When I hit /api/roles it returns an empty array Identity Models namespace API.Models { // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. public class ApplicationUser : IdentityUser<string, IdentityUserLogin,

ASP.NET Identity 2 UserManager get all users async

左心房为你撑大大i 提交于 2019-12-03 10:07:08
Can somebody tell if there is a way to get all users async in ASP.NET Identity 2? In the UserManager.Users there is nothing async or find all async or somwething like that There is no way to do this asynchronously with the UserManager class directly. You can either wrap it in your own asynchronous method: (this might be a bit evil) public async Task<IQueryable<User>> GetUsersAsync { return await Task.Run(() => { return userManager.Users(); } } Or use the ToListAsync extension method: public async Task<List<User>> GetUsersAsync() { using (var context = new YourContext()) { return await

Url Authorization with MVC and ASP.NET Identity

﹥>﹥吖頭↗ 提交于 2019-12-03 08:58:45
问题 I want to secure specific folders and resources in my application that are outside of the routes for my mvc application. I want these resources to only be available to authenticated users ( which role is not of concequence as long as they are authenticated ). Initially it seemed that the UrlAuthorizationModule would be the answer. I followed this article, Understanding IIS 7.0 URL Authorization, and I can get the module to work in the sense that it responds to the configuration elements in

Understanding MVC-5 Identity

ⅰ亾dé卋堺 提交于 2019-12-03 07:54:21
问题 I created a new ASP.NET MVC-5 application with Individual User Accounts and then updated all the Nuget packages in the solution. Now I'm trying to follow some of the guidelines shown in some tutorials but I encountered some problems. The first one is that a class called ApplicationRoleManager which is being used throughout the application wasn't created (the ApplicationUserManager was created). The second problem is more about Entity-Framework : I've seen that for seeding the database with a

ASP.NET MVC5 - Keeping Users in Oracle Database

让人想犯罪 __ 提交于 2019-12-03 07:40:09
问题 Once creating a ASP.NET MVC5 project (with target framework is .NET 4.5.1 and the authentication type is Individual User Account ), so what is the most elegant way to configure the project so that it keeps the user, claims, roles etc. in an Oracle 12c database? I mean, how can I keep the authorization/authentication data in Oracle without deforming the automatically-generated MVC5 project structure. I guess changing the <defaultConnection> tag is not enough and there should be another Oracle

Cannot login on ASP.NET Identity 2 site after programmatic user creation

自古美人都是妖i 提交于 2019-12-03 07:24:49
问题 I have a new MVC 5 razor, EF 6 web application using ASP.NET Identity 2 for the membership system. When I create the users manually using the Register link on the web page, it goes fine. I can create the user, I can then login with the given password and then logout. I don't know how to use the database initializer with migration for Identity 2, there are countless examples with Identity 1 and other alpha and beta versions which only serve to confuse people. Since I don't know that yet, I use

OWIN Bearer Token Authentication

无人久伴 提交于 2019-12-03 07:20:19
问题 I have some questions related to Bearer Token. In Owin you can protect a ticket Protect(ticket) like this: ClaimsIdentity identity = new ClaimsIdentity(Startup.OAuthServerOptions.AuthenticationType); identity.AddClaim(new Claim(ClaimTypes.Name, user.UserName)); Dictionary<string, string> properties = new Dictionary<string, string>(); properties.Add("UserId", user.Id); properties.Add("UserName", user.UserName); properties.Add("Role", "user"); AuthenticationProperties properties = new