asp.net-identity

ASP.NET MVC 5 - IdentityUser in WCF?

Deadly 提交于 2019-12-08 08:30:12
问题 I am currently writing a WCF service that will use ASP.NET Identity to perform all membership and claims related stuff. (That is, authentication, registration, and all will be performed by calling this WCF) [DataContract(IsReference=true)] public class ApplicationUser: IdentityUser { [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] public string Email { get; set; } } The problem is that "IdentityUser" is a class in Microsoft

asp.net mvc5 forms authentication, how does OWIN come in to place?

匆匆过客 提交于 2019-12-08 08:13:08
问题 I started a new MVC5 project and am implementing forms authentication (which I used to do using custom code to check the user credentials and the FormsAuthentication object to login and logoff). Now I've read that the identity model has changed, but I saw this line of code in the generated code: private IAuthenticationManager AuthenticationManager { get { return HttpContext.GetOwinContext().Authentication; } } Because later on the login is done on that object ( AuthenticationManager.SignIn )

Cannot retrieve inherited custom property value from AspNetUsers table

一笑奈何 提交于 2019-12-08 06:33:46
问题 I use ASP.NET Identity 2.0 and create two different user entities inherited from ApplicationUser as posted on Implementing Inheritance with the Entity Framework 6 in an ASP.NET MVC 5 but I cannot reach these custom properties and its values (StudentNumber and Profession) while reaching custom properties defined in ApplicationUser (Name, Surname). And idea? Here is the code I tried to use for retrieving value Name , Surname , StudentNumber and Profession : Controller: public AccountController

asp.net identity: after authentication, add custom user claims to a token provided by AAD

时光怂恿深爱的人放手 提交于 2019-12-08 06:30:22
After a webapp is successfully authenticated by Azure Active Directory, I need to add custom claims to the token. Essentially I want to do this in one of my controllers: if (ExistsUserInDb(User.Identity.Name)) { User.Identity.AddClaim("superUser", "true"); } So that I can keep on reusing the same token when that user does some superPrivilege action on other controllers. Is this possible? I've tried these links but they didn't work for me: How to extend available properties of User.Identity How to add claims in ASP.NET Identity asp.net identity: after authentication, add custom user claims to a

asp.net identity: after authentication, add custom user claims to a token provided by AAD

我怕爱的太早我们不能终老 提交于 2019-12-08 05:48:51
问题 After a webapp is successfully authenticated by Azure Active Directory, I need to add custom claims to the token. Essentially I want to do this in one of my controllers: if (ExistsUserInDb(User.Identity.Name)) { User.Identity.AddClaim("superUser", "true"); } So that I can keep on reusing the same token when that user does some superPrivilege action on other controllers. Is this possible? I've tried these links but they didn't work for me: How to extend available properties of User.Identity

ASP Identity 2 + Web API Token Auth - Persistent claims not Loading

点点圈 提交于 2019-12-08 05:41:58
问题 Im having some trouble with claims in ASP.NET Web API Token Auth. Essentially I have created a user with some claims (values are being stored in the AspNetUserClaim table) but when the users identity is created, those claims are not being pulled from the database. A breakdown of my setup is as follows. User Class: Has a GenerateUserIdentityAsync method (pretty standard) and a couple of custom properties: public class LibraryUser : IdentityUser{ //Add Custom Properties Here public string

Decrypt Asp Net Core Identity cookie on PHP

非 Y 不嫁゛ 提交于 2019-12-08 05:38:40
问题 I use ASP Net Core identity on a domain *.xyz.com, the user can log-in either on xyz.com or aaa.xyz.com, both are on ASP.Net Core and I can share the identity without issue. I would like to set-up another subdomain like blog.xyz.com based on wordpress. I would like to auto-authenticate on this site, based on the cookie created by ASP. Is it possible to decrypt this cookie in PHP? This is not about cross-domain issues, but about ASP Net Core identity Cookie decrypt in PHP. 来源: https:/

Cookie does not slide on server but does when run locally

非 Y 不嫁゛ 提交于 2019-12-08 05:06:44
问题 I have an Identity server 4 application with asp .net identity. I have the cookies set up to slide. services.ConfigureApplicationCookie(opts => { opts.Cookie.Expiration = TimeSpan.FromDays(30); opts.SessionStore = new RedisCacheTicketStore(new RedisCacheOptions() { Configuration = configuration["Redis:HostPort"] }, logger, configuration); opts.Cookie.SameSite = SameSiteMode.None; opts.SlidingExpiration = true; opts.ExpireTimeSpan = TimeSpan.FromDays(30); } ); Not Sliding Localhost: When the

User Role/Authorization doesn't work in ASP.NET Identity

耗尽温柔 提交于 2019-12-08 04:50:54
问题 have this (model builder) code on our DbContext.cs base.OnModelCreating(modelBuilder); modelBuilder.Entity<IdentityUserLogin>().HasKey<string>(l => l.UserId); modelBuilder.Entity<IdentityRole>().HasKey<string>(r => r.Id); modelBuilder.Entity<IdentityUserRole>().HasKey(r => new { r.RoleId, r.UserId }); modelBuilder.Entity<ApplicationUser>().ToTable("ApplicationUser"); Everything works fine except for Authorization/User Roles . After checking all tables I noticed that IdentityUserRoles table

Transactions with ASP.NET Core 1.0 Identity UserManager

对着背影说爱祢 提交于 2019-12-08 03:56:11
问题 In one of my apps, I'm rewriting Asp Core Identity UserManager's CreateAsync, to in addition to creating new user in UserStore - create a new row in a separate statistics table (on a different dbcontext). Problem is, I would like both of those operations to be fired inside a transaction, so that if one fails - the other does not commit. Here's the code : public override async Task<IdentityResult> CreateAsync(TUser user, string password) { // We need to use transactions here. var result =