简体   繁体   中英

Azure Active Directory Authentication Error in Azure Management Library

I'm developing a windows phone app by using Azure Management Libraries in order to manage my Azure Websites. I used Azure Active Directory for authentication as mentioned here and everthing works great for me. But I'm getting "AuthenticationFailed: A security token exception occurred for the received JWT token" error when a different user signs in with his account.

Is there any way to make my windows phone app accessible for anyone who has an Azure Subscription? How can I handle this authentication problem to use MAML ?

The problem is that the application you are creating is allowed to access your resources, and not the resources of other subscriptions.

I think the only way to do this to use the publish settings file downloading from here .

After your users download the publish setting file they can use that to manage resources described at this post .

As user2955724 has pointed out, you can get the list of subscriptions belonging to an account but you can't manage any resources related to it using Azure AD unless the particular user is in your AD.

I faced the same problem and had to resort to using publish settings file. I included a Webview which links to publish settings download link. You parse the file and get the certificate and subscription id.

There is no X.509Certificate2 class in Windows Phone APIs but you can use the Windows.Security.Cryptography.Certificates namespace to attach the certificate to your HTTP request.

public async Task<Certificate> GetCertificate(string certificateRawData)
{
     await CertificateEnrollmentManager.ImportPfxDataAsync(certificateRawData,"",ExportOption.Exportable,KeyProtectionLevel.NoConsent,InstallOptions.None,"friendlyName");
     CertificateQuery cq=new CertificateQuery();
     cq.FriendlyName="friendlyName";
     var certs=CertificateStores.FindAllAsync(cq);
     return certs[0];//return Certificate object
}

Attach this certificate to an instance of HttpBaseProtocolFilter .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM