-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issuer parameter added to the GenerateAuthUri method (#40)
* .NET Framework 471 architecture added. Version bump to 1.2.3 * adding issuer parameter to the auth jwt to handle the Epic samlResponse generation * version bump to 1.2.4 * added unit tests and issuer validation * end of lines fixed * extra whitespace removed * Moving the issuer parameter to the ClientBuilder and renaming it to audienceIssuer
- Loading branch information
Showing
4 changed files
with
60 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,35 @@ public void TestSuccess(string username) | |
Assert.True(authUri.StartsWith($"https://{API_HOST}")); | ||
} | ||
|
||
[Test] | ||
[TestCase(USERNAME)] | ||
[TestCase("I iz a user")] | ||
[TestCase("[email protected]")] | ||
public void TestSuccessWithIssuer(string username) | ||
{ | ||
Client clientWithIssuer = new ClientBuilder(CLIENT_ID, CLIENT_SECRET, API_HOST, REDIRECT_URI).UseAudienceIssuer("http://issuer").Build(); | ||
string authUri = clientWithIssuer.GenerateAuthUri(username, STATE); | ||
Assert.True(Uri.IsWellFormedUriString(authUri, UriKind.Absolute)); | ||
Assert.True(authUri.StartsWith($"https://{API_HOST}")); | ||
} | ||
|
||
[Test] | ||
[TestCase(" ")] | ||
public void TestInvalidIssuer(string issuer) | ||
{ | ||
Client clientWithIssuer = new ClientBuilder(CLIENT_ID, CLIENT_SECRET, API_HOST, REDIRECT_URI).UseAudienceIssuer(issuer).Build(); | ||
Assert.Throws<DuoException>(() => clientWithIssuer.GenerateAuthUri("username", STATE)); | ||
} | ||
|
||
[Test] | ||
[TestCase(null)] | ||
public void TestNullIssuer(string issuer) | ||
{ | ||
Client clientWithIssuer = new ClientBuilder(CLIENT_ID, CLIENT_SECRET, API_HOST, REDIRECT_URI).UseAudienceIssuer(issuer).Build(); | ||
string authUri = clientWithIssuer.GenerateAuthUri("username", STATE); | ||
Assert.True(Uri.IsWellFormedUriString(authUri, UriKind.Absolute)); | ||
} | ||
|
||
[Test] | ||
[TestCase(null)] | ||
[TestCase("")] | ||
|
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