asp.net-identity

Aspnetboilerplate: Configure login path for redirect on core mvc template

不打扰是莪最后的温柔 提交于 2019-12-24 19:12:43
问题 Sorry if this is straightforward, but I'm having a real block with this one. I'm trying to move all the standard views and controllers from aspnetboilerplate's Module Zero (Core + MVC + jQuery) into a new area (Admin) and want to make sure the redirect for login on unauthorized view goes to /Admin/Login as opposed to /Account/Login, which is the default. Any help really appreciated. Dale Update Here is the ConfigureServices method: public IServiceProvider ConfigureServices(IServiceCollection

Asp.net React+Redux, tracking a user who has logged in?

你离开我真会死。 提交于 2019-12-24 18:34:08
问题 I've set up an Asp.Net Identity system for my WebAPI using this tutorial: http://www.binaryintellect.net/articles/b957238b-e2dd-4401-bfd7-f0b8d984786d.aspx, everything works great and the only difference is I'm using React+Redux for my frontend which sends action calls to the WebAPI which takes care of user registrations and logging in. When registering users are created successfully and added to a database, when logging in signInManager.SignIn() returns success so everything is great.

How do I dependency inject SignInManager?

蹲街弑〆低调 提交于 2019-12-24 18:23:27
问题 I have a WebAPI app which I'm using a 3rd party authenticator (Firebase authentication). I have the authentication working but once the user has logged into my server, I'd like to save credentials and user data into my ASP.NET Identity tables. I seem to be able to use the UserManager to create accounts if I call this line in my Startup.cs file services.AddIdentityCore<ApplicationUser>() .AddEntityFrameworkStores<ApplicationDbContext>(); This allows me to add UserManager in my constructor

Jwt Authentication doesn't work in Blazor Serverside

試著忘記壹切 提交于 2019-12-24 18:22:32
问题 I used Jwt authentication in a Blazor Client Hosted project with roles and everything (using Identity), But when I do the same thing in Blazor Server side It doesn't work, For example After I set the token in the Header: client.DefaultRequestHeaders.Add("Authorization", $"Bearer {Model.Token}"); Console.WriteLine($"Is authenticated = {httpContext.HttpContext.User.Identity.IsAuthenticated}"); IsAuthenticated returns false, and when I navigate to home page (to cause a refresh) the

Losing HttpContext with async await in ASP.NET Identity GetRolesAsync

三世轮回 提交于 2019-12-24 17:53:06
问题 This is more of an async/await question than ASP.NET Identity. I am using Asp.Net Identity, and have a custom UserStore, with a customized GetRolesAsync method. The UserManager is called from a WebApi controller. public class MyWebApiController { private MyUserManager manager = new MyUserManager(new MyUserStore()); [HttpGet] public async Task<bool> MyWebApiMethod(int x) { IList<string> roles = await manager.GetRolesAsync(x); return true; } } public class MyUserManager : UserManager<MyUser,

How Can I get UserId from ConnectionId in asp.net identity framework SignalR?

雨燕双飞 提交于 2019-12-24 17:43:30
问题 I am using Asp.net Identity framework for authentication. Now I need the User id of connected client from connectionId or role of connected user. 回答1: public class WhateverHub : Hub { public override Task OnConnected() { //Get the username string name = Context.User.Identity.Name; //Get the UserId var claimsIdentity = Context.User.Identity as ClaimsIdentity; if (claimsIdentity != null) { // the principal identity is a claims identity. // now we need to find the NameIdentifier claim var

Where to filter Identity 2.0 claim ticket in a WebAPI app?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 15:42:44
问题 ASP.NET apps using OWIN permit multiple Identity sources (Facebook, Google, etc.). Most of the provider-specifc information those sources provide is irrelevant to my app, potentially even large, and I don't want it in my cookies all session. My app is primarily WebAPI, but I suspect the question applies equally to MVC and WebForms. For now, all I need is an integer account ID. Where/when should I reconstruct the identity, after external authentication? For example, here is one way I could

ASP.Net Can't Login/Register successfully ( works locally but not on Azure )

巧了我就是萌 提交于 2019-12-24 14:54:18
问题 Edit2 : What i found is that it logins correctly and give the cookie of the user ( .AspNet.ApplicationCookie ) but when it is there ( when running on the deployed version of the WebApp, not locally) nothing will load, so the eternal load is simply a redirect to the home page, i don't know what it could be.. At first i tought it was the Database connection that was wrong or something... but i just realised by login in the admin panel locally that the accounts i was trying to register using the

AspNet MVC 5 Identity confirm user registration

試著忘記壹切 提交于 2019-12-24 14:33:06
问题 I'm using ASP.NET MVC 5 Identity template and have in AccountController standard method for user registration // POST: /Account/Register [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { // bind viewModel --> Model var user = new ApplicationUser { UserName = model.Email, Email = model.Email, Fio = model.Fio, Street = model.Street, ... }; var result = await UserManager.CreateAsync(user, model

Error configuring ASP.NET Core web application with Azure App service and Facebook identity

你离开我真会死。 提交于 2019-12-24 12:34:43
问题 My ASP.Net Core 2.2 application's "Facebook external login setup" is working on my local machine but not working on Azure app service. I get a You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https:// error when the application redirects to facebook. However I have set up my application's secure url under facebook configuration=> "Valid OAuth Redirect URIs"(please see screenshot below). What am I missing? Startup.cs: public void