-
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.
Manage exceptions on JWT creation with null keys. (#847)
- Loading branch information
Showing
3 changed files
with
66 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
45 changes: 45 additions & 0 deletions
45
.../extensions/SecurityAPI/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue103626.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,45 @@ | ||
using GeneXusJWT.GenexusComons; | ||
using GeneXusJWT.GenexusJWT; | ||
using GeneXusJWT.GenexusJWTClaims; | ||
using NUnit.Framework; | ||
using SecurityAPITest.SecurityAPICommons.commons; | ||
|
||
namespace SecurityAPITest.Jwt.Other | ||
{ | ||
[TestFixture] | ||
public class TestIssue103626: SecurityAPITestObject | ||
{ | ||
protected static JWTOptions options; | ||
protected static PrivateClaims claims; | ||
protected static JWTCreator jwt; | ||
protected static string token; | ||
|
||
[SetUp] | ||
public virtual void SetUp() | ||
{ | ||
jwt = new JWTCreator(); | ||
options = new JWTOptions(); | ||
claims = new PrivateClaims(); | ||
|
||
claims.setClaim("hola1", "hola1"); | ||
claims.setClaim("hola2", "hola2"); | ||
|
||
} | ||
|
||
[Test] | ||
public void Test_SymmetricError() | ||
{ | ||
string dummytoken = jwt.DoCreate("HS256", claims, options); | ||
Assert.IsTrue(jwt.HasError()); | ||
|
||
} | ||
|
||
[Test] | ||
public void Test_AsymmetricError() | ||
{ | ||
string dummytoken = jwt.DoCreate("RS256", claims, options); | ||
Assert.IsTrue(jwt.HasError()); | ||
|
||
} | ||
} | ||
} |