-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Move remote rendering into its own SDK folder #18905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
7 commits merged into
Azure:master
from
matyrr-havok:MalcolmTyrrell/moveARRintoOwnFolder
Feb 24, 2021
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5111950
Bare move with no edits
matyrr-havok 8692470
Test resources
matyrr-havok 5b7fcb2
Copy in auth shared files
matyrr-havok 371b1c3
Trigger pipeline based on remoterendering folder
matyrr-havok a4fe93d
Update CI pipelines
matyrr-havok eef590d
Yet another pipeline change
matyrr-havok b0d6890
Fix up versions
matyrr-havok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
30 changes: 30 additions & 0 deletions
30
...rendering/Azure.MixedReality.RemoteRendering/src/Authentication/AuthenticationEndpoint.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.Core; | ||
| using System; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Azure.MixedReality.Authentication | ||
| { | ||
| internal static class AuthenticationEndpoint | ||
| { | ||
| /// <summary> | ||
| /// Constructs an authentication endpoint from a service domain. | ||
| /// </summary> | ||
| /// <param name="accountDomain">The account domain.</param> | ||
| /// <returns><see cref="Uri"/>.</returns> | ||
| public static Uri ConstructFromDomain(string accountDomain) | ||
| { | ||
| Argument.AssertNotNullOrWhiteSpace(accountDomain, nameof(accountDomain)); | ||
|
|
||
| if (!Uri.TryCreate($"https://sts.{accountDomain}", UriKind.Absolute, out Uri? result)) | ||
| { | ||
| throw new ArgumentException("The value could not be used to construct a valid endpoint.", nameof(accountDomain)); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
| } | ||
| } | ||
63 changes: 63 additions & 0 deletions
63
...Azure.MixedReality.RemoteRendering/src/Authentication/MixedRealityAccountKeyCredential.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Azure.Core; | ||
|
|
||
| namespace Azure.MixedReality.Authentication | ||
| { | ||
| /// <summary> | ||
| /// Represents an object used for Mixed Reality account key authentication. | ||
| /// </summary> | ||
| /// <seealso cref="TokenCredential" /> | ||
| internal class MixedRealityAccountKeyCredential : TokenCredential | ||
| { | ||
| private readonly Guid _accountId; | ||
|
|
||
| private readonly AzureKeyCredential _accountKey; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MixedRealityAccountKeyCredential" /> class. | ||
| /// </summary> | ||
| /// <param name="accountId">The Mixed Reality service account identifier.</param> | ||
| /// <param name="accountKey">The Mixed Reality service account primary or secondary key.</param> | ||
| public MixedRealityAccountKeyCredential(Guid accountId, string accountKey) | ||
| : this(accountId, new AzureKeyCredential(accountKey)) | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MixedRealityAccountKeyCredential" /> class. | ||
| /// </summary> | ||
| /// <param name="accountId">The Mixed Reality service account identifier.</param> | ||
| /// <param name="keyCredential">The Mixed Reality service account primary or secondary key credential.</param> | ||
| public MixedRealityAccountKeyCredential(Guid accountId, AzureKeyCredential keyCredential) | ||
| { | ||
| Argument.AssertNotDefault(ref accountId, nameof(accountId)); | ||
| Argument.AssertNotNull(keyCredential, nameof(keyCredential)); | ||
|
|
||
| _accountId = accountId; | ||
| _accountKey = keyCredential; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an <see cref="AccessToken" /> for the specified set of scopes. | ||
| /// </summary> | ||
| /// <param name="requestContext">The <see cref="TokenRequestContext" /> with authentication information.</param> | ||
| /// <param name="cancellationToken">The <see cref="CancellationToken" /> to use.</param> | ||
| /// <returns>A valid <see cref="AccessToken" />.</returns> | ||
| public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| => new AccessToken($"{_accountId}:{_accountKey.Key}", DateTimeOffset.MaxValue); | ||
|
|
||
| /// <summary> | ||
| /// Gets an <see cref="AccessToken" /> for the specified set of scopes. | ||
| /// </summary> | ||
| /// <param name="requestContext">The <see cref="TokenRequestContext" /> with authentication information.</param> | ||
| /// <param name="cancellationToken">The <see cref="CancellationToken" /> to use.</param> | ||
| /// <returns>A valid <see cref="AccessToken" />.</returns> | ||
| public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| => new ValueTask<AccessToken>(GetToken(requestContext, cancellationToken)); | ||
| } | ||
| } |
75 changes: 75 additions & 0 deletions
75
...ring/Azure.MixedReality.RemoteRendering/src/Authentication/MixedRealityTokenCredential.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Azure.Core; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Azure.MixedReality.Authentication | ||
| { | ||
| /// <summary> | ||
| /// Represents a token credential that can be used to access a Mixed Reality service. | ||
| /// Implements <see cref="TokenCredential" />. | ||
| /// </summary> | ||
| /// <seealso cref="TokenCredential" /> | ||
| internal class MixedRealityTokenCredential : TokenCredential | ||
| { | ||
| private readonly MixedRealityStsClient _stsClient; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MixedRealityTokenCredential" /> class. | ||
| /// </summary> | ||
| /// <param name="accountId">The Mixed Reality service account identifier.</param> | ||
| /// <param name="endpoint">The Mixed Reality STS service endpoint.</param> | ||
| /// <param name="credential">The credential used to access the Mixed Reality service.</param> | ||
| /// <param name="options">The options.</param> | ||
| private MixedRealityTokenCredential(Guid accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null) | ||
| { | ||
| _stsClient = new MixedRealityStsClient(accountId, endpoint, credential, options); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an <see cref="AccessToken" /> for the specified set of scopes. | ||
| /// </summary> | ||
| /// <param name="requestContext">The <see cref="TokenRequestContext" /> with authentication information.</param> | ||
| /// <param name="cancellationToken">The <see cref="CancellationToken" /> to use.</param> | ||
| /// <returns>A valid <see cref="AccessToken" />.</returns> | ||
| public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| => _stsClient.GetToken(cancellationToken); | ||
|
|
||
| /// <summary> | ||
| /// get token as an asynchronous operation. | ||
| /// </summary> | ||
| /// <param name="requestContext">The <see cref="TokenRequestContext" /> with authentication information.</param> | ||
| /// <param name="cancellationToken">The <see cref="CancellationToken" /> to use.</param> | ||
| /// <returns>A valid <see cref="AccessToken" />.</returns> | ||
| public override async ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| => await _stsClient.GetTokenAsync(cancellationToken).ConfigureAwait(false); | ||
|
|
||
| /// <summary> | ||
| /// Gets a Mixed Reality credential using the specified <paramref name="credential"/>. | ||
| /// Azure credentials are exchanged with the Mixed Reality STS service for Mixed Reality access tokens. | ||
| /// In the case of a <see cref="StaticAccessTokenCredential"/>, the credential is assumed to be a Mixed Reality | ||
| /// access token previously retrieved from the Mixed Reality STS service, so it is simply returned. | ||
| /// </summary> | ||
| /// <param name="accountId">The Mixed Reality service account identifier.</param> | ||
| /// <param name="endpoint">The Mixed Reality STS service endpoint.</param> | ||
| /// <param name="credential">The credential used to access the Mixed Reality service.</param> | ||
| /// <param name="options">The options.</param> | ||
| /// <returns><see cref="TokenCredential"/>.</returns> | ||
| public static TokenCredential GetMixedRealityCredential(Guid accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions? options = null) | ||
| { | ||
| if (credential is StaticAccessTokenCredential) | ||
| { | ||
| // Static access tokens are assumed to be Mixed Reality access tokens already, so we don't need to exchange | ||
| // them using the MixedRealityTokenCredential. | ||
| return credential; | ||
| } | ||
|
|
||
| return new MixedRealityTokenCredential(accountId, endpoint, credential, options); | ||
| } | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
...ring/Azure.MixedReality.RemoteRendering/src/Authentication/StaticAccessTokenCredential.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.Core; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Azure.MixedReality.Authentication | ||
| { | ||
| /// <summary> | ||
| /// Represents a static access token credential. | ||
| /// Implements the <see cref="TokenCredential" />. | ||
| /// </summary> | ||
| /// <seealso cref="TokenCredential" /> | ||
| internal class StaticAccessTokenCredential : TokenCredential | ||
| { | ||
| private readonly AccessToken _token; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="StaticAccessTokenCredential"/> class. | ||
| /// </summary> | ||
| /// <param name="token">The token.</param> | ||
| public StaticAccessTokenCredential(AccessToken token) => _token = token; | ||
|
|
||
| /// <summary> | ||
| /// Gets an <see cref="AccessToken" /> for the specified set of scopes. | ||
| /// </summary> | ||
| /// <param name="requestContext">The <see cref="TokenRequestContext" /> with authentication information.</param> | ||
| /// <param name="cancellationToken">The <see cref="CancellationToken" /> to use.</param> | ||
| /// <returns>A valid <see cref="AccessToken" />.</returns> | ||
| public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| => this._token; | ||
|
|
||
| /// <summary> | ||
| /// Gets an <see cref="AccessToken" /> for the specified set of scopes. | ||
| /// </summary> | ||
| /// <param name="requestContext">The <see cref="TokenRequestContext" /> with authentication information.</param> | ||
| /// <param name="cancellationToken">The <see cref="CancellationToken" /> to use.</param> | ||
| /// <returns>A valid <see cref="AccessToken" />.</returns> | ||
| public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| => new ValueTask<AccessToken>(this._token); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.