2017-05-12 1 views
0
내가 푸른 Active Directory 응용을 생성하고 사용하려면 다음 튜토리얼의 코드를 적용

로그인 : 로그인 후 https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/ASP 핵심 푸른 Active Directory는 - 성과 이름을 얻기

다음 반환 내 이메일 ADRESS :

Console.WriteLine(User.Identity.Name) 

이 사용자의 이름과 성을 어떻게 확인할 수 있습니까?

+0

당신이 그래프 API를 사용하여 시도? – Prasanth

+1

OpenId 범위는 토큰의 이름 및 성 요구를 반환합니다. authN 후 클레임 교장에서 추출 할 수 있어야합니다. – Mardoxx

답변

3

는 발견 :

var fn = User.FindFirst(ClaimTypes.GivenName).Value; 
var ln = User.FindFirst(ClaimTypes.Surname).Value; 
System.Console.WriteLine("me :" + fn + " " + ln); 
관련 문제