小编Vla*_*lyk的帖子

如何通过AAD验证Azure服务管理请求

我尝试了3种没有结果的方法:

  1. 根据这篇文章https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx我在AAD注册了新的Web应用程序,具有访问Azure Service Management API的权限(步骤1-9)并编写建议的两行代码来获取令牌:
    var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
    var result = context.AcquireToken("https://management.core.windows.net/", clientId, new Uri(redirectUri));
Run Code Online (Sandbox Code Playgroud)

,但它失败,但例外:

Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException was unhandled
Message: An unhandled exception of type 'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException' occurred in Microsoft.IdentityModel.Clients.ActiveDirectory.dll
Additional information: AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.
Trace ID: aa2d6962-5aea-4f8e-bed4-9e83c7631887
Correlation ID: f7f1a61e-1720-4243-96fa-cff182150931
Run Code Online (Sandbox Code Playgroud)
  1. 我也尝试过:
    var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
    var result = context.AcquireToken("https://management.core.windows.net/", new ClientCredential(clientId, clientSecret));
Run Code Online (Sandbox Code Playgroud)

其中clientSecret是我的应用程序的秘密应用程序密钥.此版本返回一个令牌,但使用此令牌的请求将返回403 Forbidden:服务器无法验证请求.验证证书是否有效并与此订阅相关联.

  1. 最后,我找到了http://blogs.msdn.com/b/cloud_solution_architect/archive/2015/03/02/authenticating-azure-service-management-api-with-azure-ad-user-credentials.aspx,建议:
    var context = new AuthenticationContext(string.Format("https://login.windows.net/{0}", tenantId));

    // …
Run Code Online (Sandbox Code Playgroud)

c# authentication azure azure-active-directory azure-management-api

7
推荐指数
1
解决办法
6046
查看次数

DocumentDB UnauthorizedException:“在 HTTP 请求中找到的 MAC 签名与计算的签名不同。”

从 DocumentDB 请求文档时,我偶尔会遇到 UnauthorizedException。该问题与Azure DocumentDB类似- HTTP 请求中发现的 MAC 签名与计算出的签名不同,因此我认为该问题没有解决。

Microsoft.Azure.Documents.UnauthorizedException : 
Message: "The MAC signature found in the HTTP request is not the same as the computed signature. 
Request URI: rntbd://db5prdddc01-docdb-1.documents.azure.com:14245/apps/35e0fabb-e03e-48d4-90ad-7b91b63c0153/services/9bb95f7b-9ad6-4128-a66a-de68279d5124/partitions/44a24d42-a85c-42cc-98c4-fc8a733245ac/replicas/130953283548138839p/
Run Code Online (Sandbox Code Playgroud)

更新:问题已修复,特别感谢 Andrew Liu!

azure azure-sdk-.net azure-cosmosdb

3
推荐指数
2
解决办法
2909
查看次数

带有方形图像的 Xamarin Forms CollectionView

我想使用 Xamarin Forms 将图像列表显示为具有多行(2 或 4)的网格。网格的每个单元格必须是正方形的。我在 DataTemplate 中使用具有垂直布局、所需跨度和固定 HeightRequest 的 CollectionView。我得到多列网格,但我无法使图像(单元格)平方。

<CollectionView ItemsSource="{Binding .}">
            <CollectionView.ItemsLayout>
                <GridItemsLayout Orientation="Vertical" Span="2" />
            </CollectionView.ItemsLayout>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Image
                        HeightRequest="100"
                        x:Name="imageCell"
                        Aspect="AspectFill"
                        Source="{Binding .}" />
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
Run Code Online (Sandbox Code Playgroud)

collectionview xamarin xamarin.forms

2
推荐指数
1
解决办法
4058
查看次数