-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Identity] Throw CredentialUnavailableException from credentials not …
…supporting ADFS (#14763) * [Identity] Throw CredentialUnavailableException from credentials not supporting ADFS * moving tenantId check to after it's read from settings * fix check to use local variable
- Loading branch information
Showing
6 changed files
with
51 additions
and
0 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
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
28 changes: 28 additions & 0 deletions
28
sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialTests.cs
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,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Threading; | ||
using Azure.Core; | ||
using Azure.Core.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.Identity.Tests | ||
{ | ||
public class VisualStudioCodeCredentialTests : ClientTestBase | ||
{ | ||
public VisualStudioCodeCredentialTests(bool isAsync) : base(isAsync) | ||
{ | ||
|
||
} | ||
|
||
[Test] | ||
public void AdfsTenantThrowsCredentialUnavailable() | ||
{ | ||
var options = new VisualStudioCodeCredentialOptions { TenantId = "adfs", Transport = new MockTransport() }; | ||
|
||
VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(options)); | ||
|
||
Assert.ThrowsAsync<CredentialUnavailableException>(async () => await credential.GetTokenAsync(new TokenRequestContext(new[] { "https://vault.azure.net/.default" }), CancellationToken.None)); | ||
} | ||
} | ||
} |
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