我正在创建一个UWP应用程序,该应用显示某些数据,具体取决于用户的登录。用户在Windows Azure中登录,并且计算机帐户也将连接到Azure。我在应用清单中启用了"帐户信息"功能。
我正在尝试使用用户类找出用户数据,如在线几个示例中所述:
private async void GetAllUserData()
{
var users = await User.FindAllAsync();
foreach (var user in users)
{
var authenticationStatus = user.AuthenticationStatus;
var nonRoamableId = user.NonRoamableId;
var provider = await user.GetPropertyAsync(KnownUserProperties.ProviderName);
var accountName = await user.GetPropertyAsync(KnownUserProperties.AccountName);
var displayName = await user.GetPropertyAsync(KnownUserProperties.DisplayName);
var domainName = await user.GetPropertyAsync(KnownUserProperties.DomainName);
var principalName = await user.GetPropertyAsync(KnownUserProperties.PrincipalName);
var firstName = await user.GetPropertyAsync(KnownUserProperties.FirstName);
var guestHost = await user.GetPropertyAsync(KnownUserProperties.GuestHost);
var lastName = await user.GetPropertyAsync(KnownUserProperties.LastName);
var sessionInitiationProtocolUri = await user.GetPropertyAsync(KnownUserProperties.SessionInitiationProtocolUri);
var userType = user.Type;
}
}
我从用户对象获得的唯一属性是:
- displayName
- AuthenticationStatus
- nonroamableId
- USERTYPE
所有其他属性都保持空。从我的理解中,当我登录到Windows Azure时,至少主要名称应该具有值。
我在做什么错 - 或换句话说 - 我该怎么做才能获取帐户信息?
在我的应用清单中启用"企业身份验证"功能后,upn填充在princtionalname变量中。
我知道,这不是该应用程序的真正身份验证作业,但是出于我的目的,将UPN在Windows中进行认证。
。有关在应用程序中添加Azure身份验证的更多信息,我找到了以下链接:
https://learn.microsoft.com/en-us/azure/app-service-mobile/App-service-service-mobile-windows-windows-dotnet-get-get-start- start- started-users
https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-native-native-uwp-v2/