asp.net-identity

How do I initially setup roles and users (like a site admin) with ASP.NET MVC Core? [closed]

家住魔仙堡 提交于 2019-12-21 22:50:34
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . While there seems to be a lot of documentation about verifying roles, claims, etc with ASP.NET Core, there is little information about initially setting these things up in my app. 回答1: The best way to configure roles, claims, etc, is in your app startup. The new ASP.NET Core

MVC. Net Error: Format of the initialization string does not conform to specification starting at index 0

独自空忆成欢 提交于 2019-12-21 21:43:19
问题 My Connection String is: <add name="RpsEntities" connectionString="server=localhost;port=3306;database=db_rps_development;uid=root;password=" providerName="MySql.Data.MySqlClient" /> which is working fine in my DAL project where I have migrations configuration. My Above mentioned connection string is not working with .Net identity and that exists into MVcWebApp, let me show you how am I am using: My bootstrap class which I am calling from Global.asax public class Bootstrapper { public static

OpenIdConnectAuthenticationHandler: message.State is null or empty

允我心安 提交于 2019-12-21 20:44:15
问题 I am using UseOpenIdConnectAuthentication middleware for ASP.Net Core application to authenticate against Dells Cloud access manager token provider (setup to provide OpenId/OAuth2 authentication). Following is the code: app.UseCookieAuthentication(new CookieAuthenticationOptions { AutomaticAuthenticate = true, AutomaticChallenge = true, AuthenticationScheme = "ClientCookie", CookieName = CookieAuthenticationDefaults.CookiePrefix + "ClientCookie", ExpireTimeSpan = TimeSpan.FromMinutes(5),

RemoveClaimAsync Identity 2.2

☆樱花仙子☆ 提交于 2019-12-21 20:13:55
问题 I have problem with Identity 2.0 . I'm trying to update claim on a user. So here is my code. var UserID = User.Identity.GetUserId(); var claims = await UserManager.GetClaimsAsync(UserID); var displayName = claims.FirstOrDefault(i => i.Type == "DisplayName"); var isPublic = claims.FirstOrDefault(i => i.Type == "IsPublic"); if (displayName != null) await UserManager.RemoveClaimAsync(UserID, displayName); if (isPublic != null) await UserManager.RemoveClaimAsync(UserID, isPublic); await

Asp.net Identity, Generate WebApi token OAuthGrantResourceOwnerCredentialsContext - no access to UserManager using Unity

给你一囗甜甜゛ 提交于 2019-12-21 20:09:29
问题 I am trying to setup a project structure so that I have a WebApi, WebUI and Domain layer. I have moved all the Asp.Net.Identity objects into the Domain layer and have also setup the ApplicationContext here too (inheriting from IdentityContext). (I have used this tutorial and package as a base which is excellent. http://tech.trailmax.info/2014/09/aspnet-identity-and-ioc-container-registration/) In the WebAPI layer I am able to use the Account controller correctly to login and register. However

How to force an HTTPS callback using Microsoft.AspNetCore.Authentication.Google?

蹲街弑〆低调 提交于 2019-12-21 19:44:11
问题 I am creating an AspNetCore application with Google authentication. I am deploying this app behind an nginx reverse proxy on an Ubuntu server. Almost everything is working, but I am having trouble with the callback url. In the Google developer console, I have http://localhost:5000/signin-google set as an authorized redirect URI. This works as expected and allows me to use Google authentication when running from my workstation. For production, I have https://myserver/signin-google set as an

IdentityUser in Data layer

我只是一个虾纸丫 提交于 2019-12-21 15:38:13
问题 I am struggling with my design (or over-design) of a web project I am doing. I have a MyProject.Data, MyProject.Business, and MyProject.Web DLL's. My data layer (EF6 based) contains my entities, db context. My business layer contains my repositories (yeah maybe not a true repo pattern). I have added IdentityFramwork to the Web Project, and of cource it creates ApplicationUser. I already have a User POCO in my Data layer. I would like to move the Application user into the Data layer, so I can

Azure ActiveDirectory Graph API GraphClient not returning AD Groups

旧时模样 提交于 2019-12-21 14:38:31
问题 I want to retrieve a User's Group information from Azure AD. Using the following Graph API packages to achieve this Microsoft.Azure.ActiveDirectory.GraphClient Microsoft.IdentityModel.Clients.ActiveDirectory 2.13.112191810 I am able to successfully retrieve Users information from the Azure Graph API. But when I run this method to retrieve a User's groups, Fiddler shows a successful HTTP 200 response with JSON fragment containing group information however the method itself does not return with

Mvc login with Web API [closed]

心不动则不痛 提交于 2019-12-21 13:09:34
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . In my solution folder there are two projects Myproject.API Myproject.Web API will server all the request to My Mvc web or android or IOS client. Now Here I'm confused, Where should I Implement Authentication process. At API or At API and MVC both As MVC identity uses Cookie based

Is User.Identity.GetUserId cached or does it fetch from the database every time?

牧云@^-^@ 提交于 2019-12-21 13:07:52
问题 I'm using ASP.Net MVC 5 and I'm calling this line all over my code string userId = User.Identity.GetUserId(); Does ASP.NET MVC go and fetch this from the table for each call, or does it get cached? 回答1: It seems that the id along with the username are cached when you login. I've used SQL Server Profiler and after logged in running User.Identity.GetUserId(); the identity system made no queries to the database. This is the query made on loggin: exec sp_executesql N'SELECT [UnionAll2].[C2] AS