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
14
votes
1 answer

Url Authorization with MVC and ASP.NET Identity

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…
Igor
  • 60,821
  • 10
  • 100
  • 175
14
votes
1 answer

Using UserManager.FindAsync with a custom UserStore

I have implemented a custom UserStore, it implements IUserStore and IUserPasswordStore. My Login action method is as below: if (ModelState.IsValid) { if (Authentication.Login(user.Username,…
Akbari
  • 2,369
  • 7
  • 45
  • 85
14
votes
3 answers

How to add claims during user registration

I'm using ASP.NET MVC 5 project with identity 2.1.0 and VS2013 U4. I want to add claims to user during registration in order to be stored in db. These claims represent user custom properties. As I created a web page for administrator to…
Milan M.
  • 959
  • 3
  • 12
  • 27
14
votes
4 answers

Get ASP.NET Identity Current User In View

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…
Yargicx
  • 1,704
  • 3
  • 16
  • 36
14
votes
1 answer

ASP.NET Identity in Microservice Architecture

I'm attempting to implement a web app using a microservice architecture by breaking up major components into separate web servers. I'm implementing an authentication server using ASP.NET Identity (email/username logins only, no Facebook, etc) and a…
14
votes
1 answer

OWIN Bearer Token Authentication

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,…
David Dury
  • 5,537
  • 12
  • 56
  • 94
14
votes
1 answer

Can web.config httpErrors section and a WebAPI area coexist?

I have an ASP.net MVC 5 project that contains a WebAPI in a specific 'API' area. I have IIS7 error handling enabled in my web.config like this:
votive
  • 990
  • 7
  • 14
13
votes
2 answers

Remove all Roles from a user MVC 5

Peace be upon you I am trying to remove all roles from a user to disable his permissions and prevent him from accessing some pages. I found this method to remove one role and it worked: await UserManager.RemoveFromRoleAsync(userid, role); Where…
O. Haifa
  • 145
  • 1
  • 1
  • 7
13
votes
2 answers

How to check password manually in Asp.Net identity 2?

This might actually be more of a conceptual question. In Asp.Net Identity the PasswordHasher generates a different hash for the same string every time you do: new PasswordHasher.HashPassword("myString"); Now if for some reason I need to manually…
13
votes
2 answers

Insert dependent entity with ApplicationUser

I have the following entities: public class ApplicationUser : IdentityUser { ... public int? StudentId { get; set; } public virtual Student Student { get; set; } } public class Student { public int Id { get; set; } public string…
13
votes
2 answers

Change default ASP.NET Identity Two-factor remember Cookie Expire Time

I have been using ASP.NET Identity 2.2.1. Following is the code in post method of VerifyCode action. var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser:…
13
votes
2 answers

Web API 2 identity. /Token Always return 404 error

I have some problems with adopt Web API 2 Identity. In project. I add StartUp.cs Like this: using Microsoft.Owin; using Owin; [assembly: OwinStartup(typeof(MyNamespace.Startup))] namespace MyNamespace { public partial class Startup { …
CMaker
  • 664
  • 1
  • 6
  • 17
13
votes
3 answers

Register IAuthenticationManager with Simple Injector

I am having a configuration setup for Simple Injector where I have moved all of my registrations to OWIN pipeline. Now the problem is I have a controller AccountController which actually takes parameters as public AccountController( …
Joy
  • 6,438
  • 8
  • 44
  • 75
13
votes
1 answer

UserManager always null in ASPNET Identity 2 app

Setup: I have an MVC 5 app with a number of library projects, created using my own exported templates. The exported templates have been working fine. I am using ASPNET Identity. I am just using a copy of the Microsoft Aspnet Identity Sample as…
awrigley
  • 13,481
  • 10
  • 83
  • 129
13
votes
1 answer

ASP.NET Identity: Why User Properties AND Claims?

I'm truly lost in trying to understand ASP.NET Identity 2.1.0 right now, and need to go back over the basics, in order to better understand how the cookies and claims work. A basic query is around my not being sure I understand why a User needs…
stacker
  • 183
  • 11