Questions tagged [asp.net-identity-2]

The second release of the ASP.NET Identity system which was designed to replace the previous ASP.NET Membership and Simple Membership systems. Use this tag if your question deals specifically to ASP.NET Identity 2 features. The [asp.net-identity] tag should be used if your question is not specific to ASP.NET Identity 2.

Resources:

Announcing RTM of ASP.NET Identity 2.0.0

1063 questions
29
votes
3 answers

Identity 2.0 with custom tables

I'm new to ASP.NET identity and am still trying to get my head around how it all works. Unfortunately I've found many of the tutorials I've tried are for Identity 1.0, whereas I'm attempting to work with Identity 2.0. The biggest problem I am facing…
joshhendo
  • 1,964
  • 1
  • 21
  • 28
29
votes
1 answer

How do I forcefully propagate role changes to users with ASP.NET Identity 2.0.1?

I've read this and while it explains how role changes will eventually propagate to the user cookie after some time interval, I still don't understand how I force an immediate change to user roles. Do I really have to sign the user out when I…
Intoccabil
  • 313
  • 1
  • 4
  • 7
28
votes
3 answers

Updating user by UserManager.Update() in ASP.NET Identity 2

I use ASP.NET Identity 2 in an MVC 5 project and I want to update Student data by using UserManager.Update() method. However, as I inherit from ApplicationUser class, I need to map Student to ApplicationUser before calling update method. On the…
Jack
  • 1
  • 21
  • 118
  • 236
28
votes
1 answer

How can I implement Claims-Based Authorization with ASP.NET WebAPI without using Roles?

I have an ASP.Net WebAPI 2 Application that uses Claims. The claims are stored as two additional columns in a standard Identity2 AspNetUsers table: CREATE TABLE [dbo].[AspNetUsers] ( [Id] INT IDENTITY (1, 1) NOT…
26
votes
5 answers

How can customize Asp.net Identity 2 username already taken validation message?

How can i customize Asp.net Identity 2 username already taken validation message(Name XYZ is already taken.)? Thanks
26
votes
3 answers

How can I get a users role inside a WebAPI method without a lookup to the AspNetUserRoles table?

I have a stored procedure that updates status. Depending on the role of the user the stored procedure has code that may or may not allow the status change. For this reason I need to pass a role name into a stored procedure. My role name is stored on…
25
votes
3 answers

Getting the email from external providers Google and Facebook during account association step in a default MVC5 app

Apparently you can do this with the Facebook provider by adding scopes to the FacebookAuthenticationOptions object in…
PussInBoots
  • 11,028
  • 9
  • 52
  • 84
24
votes
1 answer

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

The following code is copied from the Asp.Net Identity 2.0 sample. private ApplicationUserManager _userManager; public ApplicationUserManager UserManager { get { return // Error _userManager ??…
ca9163d9
  • 27,283
  • 64
  • 210
  • 413
23
votes
2 answers

How to login using email in identity 2?

In MVC5 Identity 2 SignInManager.PasswordSignInAsync take user name for login. var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false); but my user name and email are not same. but…
22
votes
2 answers

.Net Core 2.0 Web API using JWT - Adding Identity breaks the JWT authentication

(Edit - Found proper fix! see below) OK - this is my first attempt at .Net Core 2.0 and authentication, though I've done things with Web API 2.0 in the past, and have worked fairly extensively on various MVC and Webforms ASP projects over the last…
GPW
  • 2,528
  • 1
  • 10
  • 22
22
votes
3 answers

Suppress redirect on API URLs in ASP.NET Core

I have an ASP.NET Core site that uses cookie authentication for most pages. For those pages, the default server response of providing a 302 redirect for an unauthorized client is desirable. However, the site also accepts API requests; they use API…
22
votes
5 answers

how can I get Identity UserID in the controller right after a successful login result?

I am using Identity v2 and MVC 5 for external login. In my external login callback function, I log the user in with var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false); then there is a switch for the result, and I…
21
votes
2 answers

ASP.Net Identity Login Redirect Enforce Protocol (Https)

Hopefully I'm just missing something really simple/obvious - why, and more importantly, how do you maintain (or force) the protocol during the redirect to Login? To illustrate: the original protocol is https one would think this should be the…
EdSF
  • 11,753
  • 6
  • 42
  • 83
21
votes
3 answers

Should I separate my application context from ApplicationDbContext used for identity?

In Visual-Studio 2013, when creating an ASP.NET project, it generates a file IdentityModels.cs that contains a class ApplicationDbContext, that inherits from IdentityDbContext, which eventually inherits from DbContext. Should I keep…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
20
votes
2 answers

How can I use ActiveDirectoryMembershipProvider with ASP.NET Identity?

I'm learning to use .NET Identity. I have to authenticate to Active Directory. For that purpose I am trying to use ActiveDirecotoryMembershipProvider. I have to: Authenticate user/password against Active Directory (AD). Check whether user is…
1
2
3
70 71