asp.net-identity

How do I extend IdentityRole using Web API 2 + AspNet Identity 2

怎甘沉沦 提交于 2019-12-03 00:44:04
I am attempting to extend the AspNet IdentityRole class provided in the Web API 2 (With Individual Accounts) template in the latest version of Visual Studio 2013. When I hit /api/roles it returns an empty array Identity Models namespace API.Models { // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. public class ApplicationUser : IdentityUser<string, IdentityUserLogin, ApplicationUserRole, IdentityUserClaim>, IUser, IUser<string> { [NotMapped] public virtual UserProfile

SignInManager,what it is and how,when to use?

喜欢而已 提交于 2019-12-03 00:29:38
问题 I am exploring SignInManager class. But the information given on MSDN is very useless. It only tells what are the methods and properties provided. What I am looking for is, 1) What is SignInManager? 2) How to use it? 3) And I have my own database that contains credentials related info(username and passwords) How can I use SignInmanager and how to use it so my custom database is used for authenticating users? I am using asp.net MVC 5 and Visual Studio 2015. In my sample project I have accounts

Manually validating a password reset token in ASP.NET Identity

烂漫一生 提交于 2019-12-03 00:17:29
I would like to manually validate a password reset token in ASP.NET Identity 2.0. I'm trying to create my own version of UserManager.ResetPasswordAsync(string userId, string token, string newPassword) that takes and IdentityUser instead of userId like this: UserManager.ResetPasswordAsync(IdentityUser user, string token, string newPassword) Not sure if I am doing this right, but here I am attempting to validate the code that was emailed to the user in an earlier step. I have not modified the code/token that sends the email to the user and generates the code. I am assuming this is the correct

How to use Roles in user identity in MVC 5

二次信任 提交于 2019-12-03 00:16:09
I want to use asp.net useridentity in mvc 5, I do these steps: 1) create a mvc project. 2) create my own database and change the connectionstring in web.config form: to: 3) I run the project and create a new user to add related table to my database. 4) I wanted to add a role to a user after registration a user like this code in accountControler: public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser() { UserName = model.Email, Email = model.Email }; IdentityResult result = await UserManager.CreateAsync(user, model.Password);

How to use Asp.Net Core Identity in Multi-Tenant environment

血红的双手。 提交于 2019-12-03 00:04:53
I have a working Asp.Net Core application with default Identity handling. Now I want to use it for multi domains. I extended ApplicationUser with DomainId. How can I handle not just username / email to authenticate / register the user, but also the current DomainId? It's not a problem to get the current DomainId when the user is registering, logging into the system, I have a working multi-tenant Asp.Net Core system. I have issue only with user management with DomainId. Is there any setting for this? What should I override to get this funcionality? For example UserStore, UserManager? I found

No Individual User Accounts auth option in ASP.NET Core Web API template

荒凉一梦 提交于 2019-12-02 23:39:12
I am a bit confused as to why there is no Individual User Accounts authentication option in the latest ASP.NET Core Web API template. Is it still possible to implement individual user accounts the way that the MVC template does or would it not make sense? Let's say I am creating a stand-alone web API that is going to have all of my business logic and data layer that accesses the database which has the AspNet Identity tables. I plan on making calls to this API w/ an MVC app. I know one way of doing this is to create an asp.net MVC app w/ individual user accounts auth and simply build the API

Best practice for storing ASP.NET Core Authorization claims when authenticating users against Active Directory?

萝らか妹 提交于 2019-12-02 23:02:32
I am creating an enterprise intranet ASP.NET Core MVC application. I want my users to authenticate using Active Directory and I want user authorizations (claims) stored in ApplicationDbContext . I assume that I need to use Microsoft.AspNetCore.Identity and Microsoft.AspNetCore.Identity.EntityFrameworkCore to accomplish my goals. What is the best practice for storing ASP.NET Core Authorization claims when authenticating against Active Directory? The following code will give me access to the current windows user security context (current logged in user), from within the pipeline. Somehow I need

What is the Signing Credential in IdentityServer4?

為{幸葍}努か 提交于 2019-12-02 23:01:56
We are in the process of implementing Identity Server 4 with our .NET Core web app. I went trough the Identity Server documentation. When configuring the Identity server (using DI) there is the line: .AddTemporarySigningCredential I'm trying to understand what this Signing credential is but couldn't figure out. Therefore I don't know if it's ok to use the built in temporary, or if I should provide a different one. My question is, what is a signing credential and how should I use it? In the Identity server documentation this is the definition: Adds a signing key service that provides the

ASP.NET Identity Provider SignInManager Keeps Returning Failure

女生的网名这么多〃 提交于 2019-12-02 22:04:20
I have an issue with the standard ASP Identity provider for MVC5. As soon as I log in the method: await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false); keeps returning Failure. So I started debugging, By using: UserManager.FindByEmail(model.Email); This returns a valid UserID for my user trying to log in. Then I used: SignInManager.UserManager.CheckPassword(UserIDObtainedFromFind, model.Password); And this returns true, which means that the password I provide is valid.... Any ideas on how I can trace, of debug the SignInManager

ASP.net Identity, IoC and sharing DbContext

半世苍凉 提交于 2019-12-02 21:25:17
Have anyone been successful in attaching an IoC with OWIN ASP.NET Identity to share the same DbContext as the WebApi (or MVC) application? I would like that if ASP.Net identity loads the user, it loads in the same dbcontext as used in the rest of the application. (using AutoFac as IoC - but wouldn't mind an example with other container) Edit : 06/Jan/2014: Just to be a bit more specific, when the ASP.Net identity attempts to use a DbContext it needs to be the same DbContext instance as the rest of the application. Otherwise it will create two instances of the same DbContext. I am already using