asp.net-identity

Validating a user in WCF using ASP.net Identity 2.0 Framework

别说谁变了你拦得住时间么 提交于 2019-12-24 11:34:32
问题 I have built a custom Identity.Models framework by simply extending the new asp.net identity framework 2.0 so that I can store the username and other relevant user data in my custom database instead of the default entity database which gets generated and it is working fine. Now I am building a WCF service from where I would like to authenticate these users and leverage the asp.net identity 2.0 functionalities , but unable to do so. In my WCF service I made a new Validator class extending

ASP NET Identity Manager database permissions

蓝咒 提交于 2019-12-24 11:28:07
问题 I have got Identity Manager set up and running locally, working with ASP.NET Identity. I have a SQL Server 2012 database for the backend. I can create a user and get a list back, however whenever I try and create a role, edit a user or list the roles i get the following: CREATE DATABASE permission denied in database 'master'. The user i have in the connection string is a valid SQL login and is a user on the database that Identity Manager is pointed at, (and obviously can login as i can see

Is it possible to save a role with enum parameter using Identity?

廉价感情. 提交于 2019-12-24 09:24:13
问题 I am experimenting with creating a authorization with identity. So far eveything is working with the guidlines I have found online. However I want to modify the saving of roles. I have created an enum and I save this enum to aspNetRoles table (code will follow below). The way a role is saved to a user is via the following: UserManager.AddToRole(user.Id, "Admin"); I am not a fan of sending in a string as a second paramater and wish to send an enum instead. Is this possible? My code so far:

Link ASP.Net Identity table to a user detail table

廉价感情. 提交于 2019-12-24 08:30:33
问题 I am trying to link my Identity user table to a user detail table I have created to track other user information. That user detail table is called UserProfile. I came across this link but it is not working in .NET Core 2.1: Link ASP.NET Identity users to user detail table Here is what I have currently: public class ApplicationUser : IdentityUser { [Key] public override string Id { get; set; } [ForeignKey("Id")] public virtual UserProfile UserProfile { get; set; } } [Table("UserProfile")]

MVC Individual User Accounts login value persisting

陌路散爱 提交于 2019-12-24 08:18:09
问题 I have an MVC website that uses ASP.NET Identity. This site can be used for multiple customers data, and each customer is independent to another, no data should be shared. Each transaction should happen only on that customers data when that Customer is selected. However, the Users who log in can see All customers, they just choose at login which customer to transact against. So upon login, they will pick from a Dropdown their customer, and then see all that customers items, individual

Adding entity to Identity model

北城以北 提交于 2019-12-24 07:26:38
问题 I am currently getting an error I understand the error but I don't know where I am going wrong The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUsers_dbo.CompanyDetails_userCompanyID". The conflict occurred in database "PXWHITESPIDERDEV", table "dbo.CompanyDetails", column 'companyID'. Within the IdentityModel autogenerated when you create an MVC application public class ApplicationUser : IdentityUser { public async Task<ClaimsIdentity>

Microsoft.AspNetCore.Identity UserManager GetUserAsync

南笙酒味 提交于 2019-12-24 07:19:39
问题 I've been reading the source code of UserManager.cs and I've stepped into the following block: public virtual Task<TUser> GetUserAsync(ClaimsPrincipal principal) { if (principal == null) { throw new ArgumentNullException(nameof(principal)); } var id = GetUserId(principal); return id == null ? Task.FromResult<TUser>(null) : FindByIdAsync(id); } I've been very curious if there is a reason why the above is not like this: public virtual async Task<TUser> GetUserAsync(ClaimsPrincipal principal) {

Role in user is empty

丶灬走出姿态 提交于 2019-12-24 07:13:33
问题 When I do _userManager.FindByNameAsync(email) I am able to retrieve the correct user record. However, my roles field has a count of 0. If I look in the db, there is in fact roles associated to my user's id. I am on .NET 2.0 In my startup.cs: services.AddIdentity<ApplicationUser, ApplicationRole> My applicationRole : public class ApplicationRole : IdentityRole { // public virtual ICollection<ApplicationUser> Users { get; } = new List<ApplicationUser>(); public ApplicationRole(){} public

find user role in identity asp mvc

北城以北 提交于 2019-12-24 06:35:25
问题 I am using this code for login. How can I find a user role when user login? [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task<ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return View(model); } var user = await UserManager.FindByNameAsync(model.Username); if (user != null) { if (!await UserManager.IsEmailConfirmedAsync(user.Id)) { ViewBag.errorMessage = "You must have a confirmed email to log on."; return View("Error"); } } var

ASP.NET Identity, persistent cookie - is something like this build in?

江枫思渺然 提交于 2019-12-24 06:14:37
问题 We are using CookieAuthenticationProvider and would like to implement the 'Remember me' functionality in our application that would work like this: No matter if the 'Remember me' checkbox is checked or not, the token expiration time should always be set to 30 minutes (with SlidingExpiration turned on) If user doesn't check 'Remember me' all we do is check if token expired - if it did, then user is redirected to login screen (this is build in into OWIN and works fine) However if user checks