我正在从Azure移动服务迁移到应用服务,目前正在努力寻找使用Startup.MobileApp.cs
中配置的新OWIN身份验证的AAD用户objectidentifier。 `
MobileAppSettingsDictionary settings = config.GetMobileAppSettingsProvider().GetMobileAppSettings();
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
TokenValidationParameters = new TokenValidationParameters { ValidAudience = ConfigurationManager.AppSettings["MS_AadClientID"]},
Tenant = ConfigurationManager.AppSettings["MS_AadTenants"]
});
以前我一直在寻找:
claim.Type.Contains("urn:microsoft:credentials")
但User.Identity
上的所有声明都没有提供客观标识符。
Claims
objectidentifier可在https://myapp.azurewebsites.net/.auth/me
上找到。
{"typ":"http:\/\/schemas.microsoft.com\/identity\/claims\/objectidentifier",
"val":"xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx"}
有人知道是否可以在不调用URL的情况下访问该值?
谢谢,
维夫
答案 0 :(得分:0)
在深入了解iOS和.NET server code之后,我在foo.prototype.abc = function(){
var that = this; //Keep a reference of `foo`
this.table = document.getElementById("tableID");
if (table != null) {
for (var i = 0; i < table.rows.length; i++) {
for (var j = 0; j < table.rows[i].cells.length; j++)
table.rows[i].cells[j].onclick = function () {
//this.xyz(this);
// "that" refer to the function foo
// "this" refer to the current table cell (td)
that.xyz(this);
};
}
}
}
类中找到了一个方法。
致电Microsoft.Azure.Mobile.Server.Authentication IPrincipalExtensions
你可以得到user.GetAppServiceIdentityAsync<AzureActiveDirectoryCredentials>(request);
。
请注意,如果您通过网络服务直接进行身份验证,则无法使用此功能。