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
4
votes
2 answers

Mvc identity: Adding UserId to another table

I have a Model called Sammanhang [Key] public int SammanhangsID { get; set; } public string Namn { get; set; } And I want to include the id of the users as a foreign key so that i can get a dropdown-list of all the users in the database. I…
4
votes
1 answer

Custom ASPNET Identity one to many relationship using multiple context application

Basically, I want to have a user that can create their own stories. I have these classes: public class ApplicationUser : IdentityUser { public string DisplayedName { get; set; } } public class Story { public int Id { get; set; } public string…
Boy Pasmo
  • 8,021
  • 13
  • 42
  • 67
4
votes
1 answer

Understanding MVC5 UserClaim Table

I have been doing a lot of research but none resulted in helping me understand what is the point of UserClaim Table. When you create a MVC5 project, there are some default tables created upon your database being registered. I understand the purpose…
Bagzli
  • 6,254
  • 17
  • 80
  • 163
4
votes
2 answers

Unit Test Relies on UserManager and RoleManager

I am trying to unit test some of my methods that rely on UserManager and RoleManager and am having some difficulty. Should I mock the UserManager and RoleManager and then pass it to the AdminController? or should I first access the…
Eitan K
  • 837
  • 1
  • 17
  • 39
4
votes
1 answer

Profile Image in AspNet Identity

In my application I want to show user profile image in layout page (_LoginPartial). In AspNet Identity membership their is a AspNerUser table . I want to customize this AspNerUser table to maintain image field. then show that image in Layout page…
4
votes
1 answer

'ClaimsPrincipal' does not contain a definition for 'GetUserId'

Some time ago, I created a project using the ASP.Net 5 web application template. I recall the project built at the time. Now when I try and build an old project I created I have the error Severity Code Description Project File Line …
Kirsten
  • 15,730
  • 41
  • 179
  • 318
4
votes
2 answers

ASP.NET MVC 5 Identity 2 PasswordSignInAsync method always returns false

I'm writing come code that will be for an external app. I'm trying to use Microsoft Identity 2.0 and ASP.NET MVC 5. I've customized the UserViewModel to hold FirstName and LastName And a couple of other parameters. Whenever I register a user it…
John Swaringen
  • 731
  • 4
  • 11
  • 29
4
votes
1 answer

Inject username into dbContext (Entity Framework 6) to auto-update columns ModifiedBy/CreatedBy

I am setting up a MVC 5, WebApi 2, Entity Framework solution. I want to insert audit fields in my database without writing boilerplate code to do this every time. My database entities are in their own separate project that references…
Ali
  • 1,462
  • 2
  • 17
  • 32
4
votes
1 answer

How to fake or mock user logging in (authentication) with ASP.NET MVC for functional testing

I'm building a custom permissions system for ASP.NET MVC, because the authorization system that comes with MVC just isn't flexible enough for our needs. This includes an MVC area that's packaged into a DLL along with views, CSS and JavaScript. I…
4
votes
1 answer

How do I go about adding IdentityServer3 to an existing ASP.Net Identity based project?

I'm looking to add IdentityServer3 to a web app that currently uses a standard Entity Framework, SQL Server, Code First based approach to managing users and roles. I would like to add IdentityServer3 for securing a new Web API endpoint with Basic…
Ryan O'Neill
  • 5,410
  • 4
  • 46
  • 69
4
votes
2 answers

ASP.Net Identity Force Logout From SQL

I'm using the ASPNET Identity tables for my MVC 5 application. Each night we perform "maintenance" on our database. If we modify something under that user, I want to inactivate their current session so that the next action they perform in the web…
Rafiki
  • 630
  • 1
  • 8
  • 22
4
votes
1 answer

ASP.NET MVC Identity - how to change format of generated Token in SMS

Using the two factor authentification in ASP.NET MVC / Identity, I successfully set up the UserManager.SmsService. By default, ASP.NET Identity generates a 6 digit long verification token which is sent by SMS. However, our requirement is to have a 4…
4
votes
1 answer

mvc5 identity AllowAnonymous

I am trying to understand how [AllowAnonymous] tag works. I have the following method [HttpGet] public ActionResult Add() { return View(); } When I am not logged in, I am able to open this page. I have been under the impression that I can do…
Bagzli
  • 6,254
  • 17
  • 80
  • 163
4
votes
1 answer

How to update ApplicationUser with new fields in asp.net webforms using local authentication?

I have added 3 new fields to my Register.aspx template (FirstName, LastName, BuisnessName). I have updated the database schema but when I register a new user, the user is created but the new fields are not added to the user record. I have extended…
joey.coyle
  • 107
  • 1
  • 9
4
votes
1 answer

Appending 'hd' parameter to redirectUrl ASP.NET Core 1 with Identity 3

In ASP.NET 4 with the Identity Framework 2 I can append the redirectUri with a parameter of my own, like the 'hd' parameter Google uses to limit login to a domain like this: var googleAuthOptions = new GoogleOAuth2AuthenticationOptions { …
Johan B
  • 890
  • 3
  • 23
  • 39