Skip to content

Commit 797a12c

Browse files
Mixed Reality Authentication: Updated the MR STS spec file (Azure#18341)
This change updated the library to consume the latest version of spec file, which changes the account identifier to be a `Guid` rather than a `string`. The service expects a `Guid` or `UUID`, so it makes sense to be specific.
1 parent d9829c9 commit 797a12c

File tree

8 files changed

+27
-34
lines changed

8 files changed

+27
-34
lines changed

sdk/mixedreality/Azure.MixedReality.Authentication/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release History
22

3+
## 1.0.0-preview.3 (2021-01-15)
4+
5+
- Updated to latest version of spec file which changes the account identifier to be a `Guid` rather than a `string`.
6+
37
## 1.0.0-preview.2 (2021-01-12)
48

59
- Configured with shared source.

sdk/mixedreality/Azure.MixedReality.Authentication/api/Azure.MixedReality.Authentication.netstandard2.0.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ namespace Azure.MixedReality.Authentication
33
public partial class MixedRealityStsClient
44
{
55
protected MixedRealityStsClient() { }
6-
public MixedRealityStsClient(string accountId, string accountDomain, Azure.AzureKeyCredential keyCredential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
7-
public MixedRealityStsClient(string accountId, string accountDomain, Azure.Core.TokenCredential credential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
8-
public MixedRealityStsClient(string accountId, System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
9-
public MixedRealityStsClient(string accountId, System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
10-
public string AccountId { get { throw null; } }
6+
public MixedRealityStsClient(System.Guid accountId, string accountDomain, Azure.AzureKeyCredential keyCredential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
7+
public MixedRealityStsClient(System.Guid accountId, string accountDomain, Azure.Core.TokenCredential credential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
8+
public MixedRealityStsClient(System.Guid accountId, System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
9+
public MixedRealityStsClient(System.Guid accountId, System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.MixedReality.Authentication.MixedRealityStsClientOptions? options = null) { }
10+
public System.Guid AccountId { get { throw null; } }
1111
public System.Uri Endpoint { get { throw null; } }
1212
public virtual Azure.Response<Azure.Core.AccessToken> GetToken(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1313
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Core.AccessToken>> GetTokenAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }

sdk/mixedreality/Azure.MixedReality.Authentication/shared/MixedRealityAccountKeyCredential.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Azure.MixedReality.Authentication
1414
/// <seealso cref="TokenCredential" />
1515
internal class MixedRealityAccountKeyCredential : TokenCredential
1616
{
17-
private readonly string _accountId;
17+
private readonly Guid _accountId;
1818

1919
private readonly AzureKeyCredential _accountKey;
2020

@@ -23,7 +23,7 @@ internal class MixedRealityAccountKeyCredential : TokenCredential
2323
/// </summary>
2424
/// <param name="accountId">The Mixed Reality service account identifier.</param>
2525
/// <param name="accountKey">The Mixed Reality service account primary or secondary key.</param>
26-
public MixedRealityAccountKeyCredential(string accountId, string accountKey)
26+
public MixedRealityAccountKeyCredential(Guid accountId, string accountKey)
2727
: this(accountId, new AzureKeyCredential(accountKey))
2828
{
2929
}
@@ -33,9 +33,9 @@ public MixedRealityAccountKeyCredential(string accountId, string accountKey)
3333
/// </summary>
3434
/// <param name="accountId">The Mixed Reality service account identifier.</param>
3535
/// <param name="keyCredential">The Mixed Reality service account primary or secondary key credential.</param>
36-
public MixedRealityAccountKeyCredential(string accountId, AzureKeyCredential keyCredential)
36+
public MixedRealityAccountKeyCredential(Guid accountId, AzureKeyCredential keyCredential)
3737
{
38-
Argument.AssertNotNullOrWhiteSpace(accountId, nameof(accountId));
38+
Argument.AssertNotDefault(ref accountId, nameof(accountId));
3939
Argument.AssertNotNull(keyCredential, nameof(keyCredential));
4040

4141
_accountId = accountId;

sdk/mixedreality/Azure.MixedReality.Authentication/shared/MixedRealityTokenCredential.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal class MixedRealityTokenCredential : TokenCredential
2424
/// <param name="endpoint">The Mixed Reality STS service endpoint.</param>
2525
/// <param name="credential">The credential used to access the Mixed Reality service.</param>
2626
/// <param name="options">The options.</param>
27-
private MixedRealityTokenCredential(string accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null)
27+
private MixedRealityTokenCredential(Guid accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null)
2828
{
2929
_stsClient = new MixedRealityStsClient(accountId, endpoint, credential, options);
3030
}
@@ -58,7 +58,7 @@ public override async ValueTask<AccessToken> GetTokenAsync(TokenRequestContext r
5858
/// <param name="credential">The credential used to access the Mixed Reality service.</param>
5959
/// <param name="options">The options.</param>
6060
/// <returns><see cref="TokenCredential"/>.</returns>
61-
public static TokenCredential GetMixedRealityCredential(string accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null)
61+
public static TokenCredential GetMixedRealityCredential(Guid accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null)
6262
{
6363
if (credential is StaticAccessTokenCredential)
6464
{

sdk/mixedreality/Azure.MixedReality.Authentication/src/Generated/MixedRealityStsRestClient.cs

Lines changed: 3 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/mixedreality/Azure.MixedReality.Authentication/src/MixedRealityStsClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MixedRealityStsClient
2323
/// <summary>
2424
/// Gets the Mixed Reality service account identifier.
2525
/// </summary>
26-
public string AccountId { get; }
26+
public Guid AccountId { get; }
2727

2828
/// <summary>
2929
/// The Mixed Reality STS service endpoint.
@@ -37,7 +37,7 @@ public class MixedRealityStsClient
3737
/// <param name="accountDomain">The Mixed Reality service account domain.</param>
3838
/// <param name="keyCredential">The Mixed Reality service account primary or secondary key credential.</param>
3939
/// <param name="options">The options.</param>
40-
public MixedRealityStsClient(string accountId, string accountDomain, AzureKeyCredential keyCredential, MixedRealityStsClientOptions? options = null)
40+
public MixedRealityStsClient(Guid accountId, string accountDomain, AzureKeyCredential keyCredential, MixedRealityStsClientOptions? options = null)
4141
: this(accountId, AuthenticationEndpoint.ConstructFromDomain(accountDomain), new MixedRealityAccountKeyCredential(accountId, keyCredential), options) { }
4242

4343
/// <summary>
@@ -47,7 +47,7 @@ public MixedRealityStsClient(string accountId, string accountDomain, AzureKeyCre
4747
/// <param name="endpoint">The Mixed Reality STS service endpoint.</param>
4848
/// <param name="keyCredential">The Mixed Reality service account primary or secondary key credential.</param>
4949
/// <param name="options">The options.</param>
50-
public MixedRealityStsClient(string accountId, Uri endpoint, AzureKeyCredential keyCredential, MixedRealityStsClientOptions? options = null)
50+
public MixedRealityStsClient(Guid accountId, Uri endpoint, AzureKeyCredential keyCredential, MixedRealityStsClientOptions? options = null)
5151
: this(accountId, endpoint, new MixedRealityAccountKeyCredential(accountId, keyCredential), options) { }
5252

5353
/// <summary>
@@ -57,7 +57,7 @@ public MixedRealityStsClient(string accountId, Uri endpoint, AzureKeyCredential
5757
/// <param name="accountDomain">The Mixed Reality service account domain.</param>
5858
/// <param name="credential">The credential used to access the Mixed Reality service.</param>
5959
/// <param name="options">The options.</param>
60-
public MixedRealityStsClient(string accountId, string accountDomain, TokenCredential credential, MixedRealityStsClientOptions? options = null)
60+
public MixedRealityStsClient(Guid accountId, string accountDomain, TokenCredential credential, MixedRealityStsClientOptions? options = null)
6161
: this(accountId, AuthenticationEndpoint.ConstructFromDomain(accountDomain), credential, options) { }
6262

6363
/// <summary>
@@ -67,9 +67,9 @@ public MixedRealityStsClient(string accountId, string accountDomain, TokenCreden
6767
/// <param name="endpoint">The Mixed Reality STS service endpoint.</param>
6868
/// <param name="credential">The credential used to access the Mixed Reality service.</param>
6969
/// <param name="options">The options.</param>
70-
public MixedRealityStsClient(string accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null)
70+
public MixedRealityStsClient(Guid accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null)
7171
{
72-
Argument.AssertNotNull(accountId, nameof(accountId));
72+
Argument.AssertNotDefault(ref accountId, nameof(accountId));
7373
Argument.AssertNotNull(endpoint, nameof(endpoint));
7474
Argument.AssertNotNull(credential, nameof(credential));
7575

sdk/mixedreality/Azure.MixedReality.Authentication/src/autorest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Run `dotnet build /t:GenerateCode` to generate code.
44

55
``` yaml
66
input-file:
7-
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e0b78897850ccbb648b3efe286b78e78c5cd8bcf/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/2019-02-28-preview/mr-sts.json
7+
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/aa19725fe79aea2a9dc580f3c66f77f89cc34563/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/2019-02-28-preview/mr-sts.json
88
```

sdk/mixedreality/Azure.MixedReality.Authentication/tests/MixedRealityStsClientLiveTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using System;
45
using System.Threading.Tasks;
56
using Azure.Core;
67
using Azure.Core.TestFramework;
@@ -22,7 +23,7 @@ public MixedRealityStsClientLiveTests(bool isAsync)
2223
private MixedRealityStsClient CreateClient()
2324
{
2425
string mixedRealityAccountDomain = TestEnvironment.AccountDomain;
25-
string mixedRealityAccountId = TestEnvironment.AccountId;
26+
Guid mixedRealityAccountId = Guid.Parse(TestEnvironment.AccountId);
2627
string mixedRealityAccountKey = TestEnvironment.AccountKey;
2728

2829
return InstrumentClient(new MixedRealityStsClient(

0 commit comments

Comments
 (0)