Questions tagged [asp.net-identity]

The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems.

The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems. It includes profile support, OAuth integration, works with OWIN, and is included with the ASP.NET templates shipped with Visual Studio 2013.

ASP.NET Identity uses code-first Entity Framework to allow for maximum customization through class manipulation, annotation, and new fluent API.

Useful links

8860 questions
134
votes
13 answers

Configure Microsoft.AspNet.Identity to allow email address as username

I'm in the process of creating a new application and started out using EF6-rc1, Microsoft.AspNet.Identity.Core 1.0.0-rc1, Microsoft.AspNet.Identity.EntityFramework 1.0.0-rc1, Microsoft.AspNet.Identity.Owin 1.0.0-rc1, etc and with the RTM releases…
LiamGu
  • 5,317
  • 12
  • 49
  • 68
132
votes
7 answers

ASP.NET Core Identity - get current user

To get the currently logged in user in MVC5, all we had to do was: using Microsoft.AspNet.Identity; [Authorize] public IHttpActionResult DoSomething() { string currentUserId = User.Identity.GetUserId(); } Now, with ASP.NET Core I thought this…
jbraun
  • 1,498
  • 2
  • 11
  • 10
124
votes
10 answers

ASP.NET Identity reset password

How can I get the password of a user in the new ASP.NET Identity system? Or how can I reset without knowing the current one (user forgot password)?
daniel
  • 34,281
  • 39
  • 104
  • 158
120
votes
3 answers

What is the advantage of using async with MVC5?

What is the difference between: public ActionResult Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { IdentityResult result = IdentityManager.Authentication.CheckPasswordAndSignIn(AuthenticationManager,…
116
votes
8 answers

Get the current user, within an ApiController action, without passing the userID as a parameter

How do we get the current user, within an secure ApiController action, without passing the userName or userId as a parameter? We assume that this is available, because we are within a secure action. Being in a secure action means that the user has…
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
109
votes
3 answers

The entity type 'IdentityUserLogin' requires a primary key to be defined

i am using dotnet core 1.1 on linux, and i am having issues when i want to split up the identityContext from my regular dbContext, whenever i run the following line in my startup.cs --> configure: //... some other services using (var serviceScope =…
DenLilleMand
  • 3,732
  • 5
  • 25
  • 34
92
votes
5 answers

Get current user id in ASP.NET Identity 2.0

I just switched over to using the new 2.0 version of the Identity Framework. In 1.0 I could get a user object by using manager.FindByIdAsync(User.Identity.GetUserId()). The GetUserId() method does not seem to exists in 2.0. Now all I can figure…
jasonpresley
  • 1,003
  • 1
  • 7
  • 8
89
votes
24 answers

How to localize ASP.NET Identity UserName and Password error messages?

Is it possible to provide localized strings for the "system" ASP.NET Identity v1 error messages, like "Name XYZ is already taken" or "User name XYZ is invalid, can only contain letters or digits"?
rootless
  • 1,348
  • 1
  • 10
  • 11
89
votes
11 answers

Creating Roles in Asp.net Identity MVC 5

There is very little documentation about using the new Asp.net Identity Security Framework. I have pieced together what I could to try and create a new Role and add a User to it. I tried the following: Add role in ASP.NET Identity which looks like…
colbyJax
  • 1,033
  • 1
  • 9
  • 9
88
votes
9 answers

ASP.NET Identity with EF Database First MVC5

Is it possible to use the new Asp.net Identity with Database First and EDMX? Or only with code first? Here's what I did: 1) I made a new MVC5 Project and had the new Identity create the new User and Roles tables in my database. 2) I then opened my…
85
votes
4 answers

How do I define the password rules for Identity in ASP.NET 5 MVC 6 (vNext)?

The default Identity provider provided in ASP.NET 5 has very strict password rules by default, requiring a lower case character, an upper case character, a non-alphanumeric character, and a number. I am looking for a way to change the password…
Ryan
  • 3,852
  • 4
  • 18
  • 18
84
votes
4 answers

OWIN Security - How to Implement OAuth2 Refresh Tokens

I am using the Web Api 2 template that comes with Visual Studio 2013 has some OWIN middleware to do User Authentication and the likes of. In the OAuthAuthorizationServerOptions I noticed that the OAuth2 Server is setup to hand out tokens that expire…
SimonGates
  • 5,961
  • 4
  • 40
  • 52
81
votes
1 answer

How to implement custom authentication in ASP.NET MVC 5

I'm developing an ASP.NET MVC 5 application. I have an existing DB, from which I created my ADO.NET Entity Data Model. I have a table in that DB which contains "username" and "password" column, and I want to use them to implement authentication and…
78
votes
12 answers

Updating user data - ASP.NET Identity

I've added custom fields to the ApplicationUser class I've also created a form through which the user can enter/edit the fields. However for some reason I'm not able to update the fields in the…
galdin
  • 12,411
  • 7
  • 56
  • 71
75
votes
1 answer

Registering Web API 2 external logins from multiple API clients with OWIN Identity

I would like the following architecture (I've made up the product name for this example): Web API 2 application running on one server http://api.prettypictures.com MVC 5 client app running on another server http://www.webpics.com I would like…
joshcomley
  • 28,099
  • 24
  • 107
  • 147