asp.net-identity

Temporary Session Based Claims in ASP.NET Core Identity

北慕城南 提交于 2019-12-07 00:26:44
问题 Adding claims in ASP.NET Core Identity is straight forward enough, but I'm having trouble finding how to add a temporary session based claim. My use case is such that a logged in user with their own custom claims needs to periodically have a new claim added, but only for the current session, and not persisted to the database. After they close their browser or sign out, the temporary claim should go away. This is to satisfy a mechanism that temporarily changes the organization to which a user

ASP.NET Core 1.1 getting all users and their roles

耗尽温柔 提交于 2019-12-07 00:07:29
问题 I am new to .NET trying to get a list of all the registered user along with their role names and send them to a view using a viewModel. Here's the ViewModel: public class ApplicationUserListViewModel { [Display(Name = "User Email Address")] public string UserEmail { get; set; } public List<IdentityUserRole<string>> Roles { get; set; } } I tried this for getting all users along with their roles and make a ViewModel for each user and put all the view models in a list to pass to the View: var

NormalizedUserName VS Username in DotNet Core

喜欢而已 提交于 2019-12-06 17:12:45
问题 I'm trying to create a custom implementation of IUserLoginStore for MongoDB and I noticed when using UserManager<ApplicationUser> with the method var userResult = await _userManager.CreateAsync(user); it goes through the implementation of GetUserNameAsync FindByNameAsync SetNormalizedUserNameAsync GetUserIdAsync I would like to clarify two questions: what's the purpose of having a NormalizedUsername and a UserName? the only difference that I could notice id that the normalizedUserName is in

What does “Challenge” term stand for?

拜拜、爱过 提交于 2019-12-06 17:09:11
问题 ControllerBase class has Challenge method, that returns an object of the ChallengeResult class. CookieAuthenticationOptions class has AutomaticChallenge property. I believe ChallengeResult has something to do with external logins. But how does it actually work? Where does the term "Challenge" come from? What does lay inside this. 回答1: A ChallengeResult is an ActionResult that when executed, challenges the given authentication schemes' handler. Or if none is specified, the default challenge

How to use ActiveDirectoryMembershipProvider with ASP.Net Identity?

怎甘沉沦 提交于 2019-12-06 17:04:23
问题 I am trying to learn how to use ASP.Net Identity. My scenario is that I have to authenticate against Active Directory. For that purpose I am trying to use ActiveDirecotoryMembershipProvider . What I have to do is - Authenticate user/password against Active Directory. Check whether user is present in my own database. The way I did it is I configured in my web.config to use ActiveDirectoryMembershipProvider as default membership provider. Then I override PasswordSignInAsync method in my

Extending ASP.NET MVC 5 Identity with another object

陌路散爱 提交于 2019-12-06 15:45:26
问题 I'm currently using Fluent API in which I cannot find many resources regarding extending the Identity model with another object. Here I have my object called ApplicationUser: public class ApplicationUser : IdentityUser { public virtual Staff Staff { get; set; } public int StaffId { get; set; } } In which I'd like to map it to my current Staff object: public class Staff { public int StaffId { get; set; } public string DisplayName { get; set; } public string FirstName { get; set; } public

Dynamic database connection using Asp.net MVC and Identity2

ⅰ亾dé卋堺 提交于 2019-12-06 15:04:35
问题 I'm developing a web application in asp.net mvc. My application uses multiple databases. The database on which working on depends by the logged user. I manage login on two levels: Level1 on a "master" database where I have info about the login username/email and the "specific" database to use. Level2 on the "specific" database where I manage users and roles with Identity2. Example: In the "master" database I have a record in User table with: - username = user1 - databaseToUse = "specificDb1"

Asp.Net Identity and multiple login mechanisms

。_饼干妹妹 提交于 2019-12-06 14:09:45
问题 I'd like to create an application that would be as open as possible to different login mechanisms. So I've used Asp.Net Identity. For (almost) free, this system gives me: Simple accounts OpenID with Facebook, Microsoft, Google and more If you use the other templates, you can also have Organisational Accounts with the following 3 options: Cloud - Single Organisation Cloud - Multiple Organisations On-Premises My use cases are showing that I need a mix of all of that: Users that want a simple

User creation with IdentityServer4 from multiple API's

蹲街弑〆低调 提交于 2019-12-06 13:23:33
So I have been bashing my head for a while with this problem. We have one web app that is using IdentityServer4 and AspNetIdentity to authenticate and register users ( this is working as intended ). In addition, we have an other API (inside the same solution) that is able to use IdentityServer4 to authenticate users accessing the API . However, the problem is, that besides authentication we cannot use the API to create new users . For instance, users should be able to create other users through the web API and not only from the web app, because in our case, users are linked to other users

How to resolve issues with CRUD Operations in an ASP.NET MVC Kendo UI Grid

寵の児 提交于 2019-12-06 13:23:26
I've been trying to get the Kendo UI grid to act as a user management tool in a system I'm currently writing. I've bound data to the grid, using ASP.NET Identity to get the user information, but I can't seem to get the update or delete actions to fire on the grid. I've set the grid up as below: @(Html.Kendo().Grid<MyProject.Models.UserInfo>() .Name("userGrid") .Columns(columns => { columns.Bound(p => p.UserName); columns.Bound(p => p.FirstName); columns.Bound(p => p.LastName); columns.Bound(p => p.Region); columns.Bound(p => p.Roles); columns.Command(command => { command.Edit(); command