asp.net-identity

Web API 2 OWIN Bearer token authentication - AccessTokenFormat null?

蹲街弑〆低调 提交于 2019-12-03 07:01:10
问题 I have an existing ASP.NET MVC 5 project and I'm adding a Web API 2 project to it. I want to use bearer token authentication and have followed Hongye Sun's tutorial "OWIN Bearer Token Authentication with Web API Sample" and this question as well. In my Login method, for the line Startup.OAuthBearerOptions.AccessTokenFormat.Protect(ticket); , the AccessTokenFormat is null. Any idea why? My AccountController : [RoutePrefix("api")] public class AccountController : ApiController { public

ASP.NET Identity

旧时模样 提交于 2019-12-03 06:57:44
问题 I'm currently building a new ASP.NET MVC 5 project which I want to release around September. I need to choose a membership system, but I'm currently quite confused about which direction should I take. The current SimpleMembership works well, but will apparently be incompatible with the upcoming ASP.NET Identity. ASP.NET Identity on the other hand is absolutely new with zero documentation and can change anytime. Finally it seems that string based IDs are used here, which seems like a very

Supporting Individual User Accounts AND Organizational Accounts in MVC5 / ASP.Net Identity 2

送分小仙女□ 提交于 2019-12-03 06:53:22
问题 I've created an ASP.Net MVC5 application, in which I have configured (and have working fine) Individual User Accounts via Google, Facebook, etc. What I'd like to do is also support authentication against Azure Active Directory (Organizational Accounts). This would be for internal staff to be able to logon to the app as administrators. All existing information/guides/documentation I've found typically deals with using one or the other. How would I enable them both together? If there needs to

asp.net identity 2.0 unity not resolving default user store

我与影子孤独终老i 提交于 2019-12-03 06:15:10
问题 i get the following exception when trying to configure Unity using Unity.Mvc5 with an MVC 5 application using Identity 2.0 and the Identity 2.0 Samples boilerplate. i have read this SO Configure Unity DI for ASP.NET Identity and i'm still not clear on what i'm missing. What am i doing wrong here? The current type, System.Data.Common.DbConnection, is an abstract class and cannot be constructed. Are you missing a type mapping? [ResolutionFailedException: Resolution of the dependency failed,

Regex for default ASP.NET Core Identity Password

好久不见. 提交于 2019-12-03 05:48:14
Note : This question, I believe, is not the duplicate of this question . My question is dealing with the default validation rules asp.net core identity has for password validation and how it's regex can be made, while the linked question is discussing, in general about act of validating password (which doesn't solve my problem) The ASP.NET Core enables default following password validation Minimum 8 characters Should have at least one number Should have at least one upper case Should have at least one lower case Should have at least one special character (Which special characters are allowed?)

ASP.NET Core - Add role claim to User

时光怂恿深爱的人放手 提交于 2019-12-03 05:17:49
问题 I've an ASP.NET Core (based on .NET Framework) using Windows Authentication. Point is, I need to add a role claim on that user and this role is stored in a distant database. I've read so much thing about OWIN/Cookie/UserManager/UserStore/Identity and so on that I'm lost. Question : How do I add a role claim for current user logged in (windows) for the whole application in the easiest way? What I need is to easily use [Authorize(Role= "MyAddedRole")] or bool res = User.IsInRole("MyAddedRole")

ASP.NET Identity remove column from AspNetUsers table

大兔子大兔子 提交于 2019-12-03 05:11:32
问题 When I use ASP.NET Identity first code approach, I want to generate columns in AspNetUsers table in my own way. I don't need to have stored multiple columns with null values. I just need columns Id, SecurityStamp and UserName. Only post, that I've found is here: AspNet Identity 2.0 Email and UserName duplication , but it is still unsloved (due to error in Santosh comment). So can anybody tell my how to solve this? EDIT: Is it even possible to delete some of these columns/properties? Thanks

Identity Framework test if confirm email token is expired

风格不统一 提交于 2019-12-03 04:59:14
Is it possible to test whether a confirm email token is expired using Identity Framework's UserManager ? No matter what the error is, from the following: var result = await UserManager.ConfirmEmailAsync(userId, code); I get a generic "Invalid Token" error. I found a way to parse the token for the date issued, which you can then check to see if is within the allowed timespan (default of 24hours if not specified). Identity.cs ApplicationUserManager public IDataProtector Protector { get; set; } public TimeSpan TokenLifespan { get; set; } ApplicationUserManager Create() // Explicitly set token

Proper way to get current User ID in Entity Framework Core

点点圈 提交于 2019-12-03 04:57:33
There are a bunch of different answers floating around here for the different RC's of ASP.NET Core on how to get the ID of the currently logged in user. I wanted to ask the definite question here. Please note that project.json now has "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0" With RC1, you could do something like this: using Microsoft.AspNet.Identity; using System.Security.Claims; User.GetUserId(); But with the newly released version 1 of EF Core, Microsoft.AspNet.Identity is not the right version. There was suggestions to use UserManager, which seems like a lot just to get

Setting up Forms Authentication for multiple Web Apps in MVC 5 based on OWIN

那年仲夏 提交于 2019-12-03 04:42:37
I am in process of setting up my 1st MVC Web App. I know I need to provide a Forms Based Authentication model as well as I know I will be reusing it for multiple other internal web apps as well. All the documentation for MVC 5 Authentication, which I believe is all based on OWIN stuff, have it "baked" into a single web app using EF Code First no less. What I am trying is to have an another Web App that I strip everything out of except for the Account stuff and then try to "point" my web apps Authentication to that and have it return a "token", I'm guessing, of my Authenticated User and his/her