-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Storage to track 2 SDK (#413)
* Updated storage track 2 SDK. * Take back readonly * Add catch when failed to create Blob and Blob view. * Remove redundant CreateBlob(), create Blob directly in Blob(). * Catch MsalUiRequiredException. * Updating to latest GA package. Co-authored-by: Frank Li (Wicresoft North America Ltd) <[email protected]>
- Loading branch information
Showing
6 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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 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,38 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Azure.Core; | ||
using Microsoft.Identity.Client; | ||
using Microsoft.Identity.Web; | ||
|
||
namespace WebApp_OpenIDConnect_DotNet | ||
{ | ||
public class TokenAcquisitionTokenCredential : TokenCredential | ||
{ | ||
readonly private ITokenAcquisition _tokenAcquisition; | ||
|
||
/// <summary> | ||
/// Constructor from an ITokenAcquisition service. | ||
/// </summary> | ||
/// <param name="tokenAcquisition">Token acquisition.</param> | ||
public TokenAcquisitionTokenCredential(ITokenAcquisition tokenAcquisition) | ||
{ | ||
_tokenAcquisition = tokenAcquisition; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
{ | ||
AuthenticationResult result = _tokenAcquisition.GetAuthenticationResultForUserAsync(requestContext.Scopes) | ||
.GetAwaiter() | ||
.GetResult(); | ||
return new AccessToken(result.AccessToken, result.ExpiresOn); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override async ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
{ | ||
AuthenticationResult result = await _tokenAcquisition.GetAuthenticationResultForUserAsync(requestContext.Scopes).ConfigureAwait(false); | ||
return new AccessToken(result.AccessToken, result.ExpiresOn); | ||
} | ||
} | ||
} |
This file contains 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,7 @@ | ||
@{ | ||
ViewData["Title"] = "Blob"; | ||
} | ||
|
||
<h2>@ViewData["Title"]</h2> | ||
<h3>@ViewData["Message"]</h3> | ||
|
This file contains 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 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