简体   繁体   English

AWS Cognitive Hosted UI显示在asp.net核心Web应用程序中登录了用户名

[英]AWS Cognitive Hosted UI display signed in username in asp.net core web app

We have implemented AWS Cognitive Hosted UI in my asp.net core web app and it works a treat. 我们已经在我的asp.net核心Web应用程序中实现了AWS Cognitive Hosted UI,并且可以正常工作。 We would now like to display the user information of the signed in user but aren't sure how this can be implemented. 现在,我们想显示已登录用户的用户信息,但是不确定如何实现。 Can someone point us to a working example? 有人可以指出我们一个可行的例子吗?

To access information regarding the signed in user you can use the following: 要访问有关已登录用户的信息,可以使用以下命令:

var username = HttpContext.User.Claims.FirstOrDefault(c => c.Type.Equals("cognito:username")).Value;
var givenname = HttpContext.User.Claims.FirstOrDefault(c => c.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname")).Value;
var surname = HttpContext.User.Claims.FirstOrDefault(c => c.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname")).Value;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法连接托管在 Azure Web 应用程序上的安全 Asp.Net Core Web 套接字(使用 TLS) - Can't connect secured Asp.Net Core Web Socket hosted on Azure Web App (using TLS) ASP.NET AWS 中托管的 Core 6 应用程序 Lambda function URL 处理程序 - ASP.NET Core 6 app hosted in AWS Lambda function URL Handler 从移动设备访问托管在本地主机上的 ASP.NET Core 2.1 Web 应用程序 - Access ASP.NET Core 2.1 web app hosted on localhost from mobile device 有没有办法在 Azure 上使用托管 ASP.NET 核心 web 应用程序的本地数据库? - Is there a way to use a local db with a hosted ASP.NET core web app on Azure? asp.net核心自托管应用在Webhost重生时泄漏 - asp.net core self hosted app leaks on webhost respawn 部署托管到 Azure 的 Blazor WebAssembly 应用 ASP.NET Core - Deploy Blazor WebAssembly App ASP.NET Core hosted to Azure 从作为 Azure Web 应用程序托管的 ASP.NET 5 应用程序进行日志记录 - Logging from ASP.NET 5 application hosted as Azure Web App Self Hosted Asp Net Core Web 服务器,使用自签名证书进行客户端身份验证 - Self Hosted Asp Net Core Web server, client authentication with self-signed certificates 如何在 AWS 中将我的 ASP.NET Core 5 MVC web 应用程序切换到开发模式 - How to switch my ASP.NET Core 5 MVC web app to development mode while in AWS 如何为引用Amazon AWS上托管的托管ASP.NET Web API的本地文件启用CORS - How to enable CORS for a local file that references a hosted ASP.NET Web API that is hosted on Amazon AWS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM