diff --git a/Authentication/Auth.cs b/Authentication/Auth.cs
index a19d2f4..fadddc2 100644
--- a/Authentication/Auth.cs
+++ b/Authentication/Auth.cs
@@ -37,43 +37,89 @@ namespace raven_integration
[Fact]
public async void JWTExpiredTokenShouldFail()
{
-
- //Expect status code 401 and result:
- // {{
- // "error": {
- // "code": "2003",
- // "message": "Authentication failed"
- // }
- // }}
- ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST","EXPIRED"));//lowest level test user because there are no limits on this route except to be authenticated
+ ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "EXPIRED"));//lowest level test user because there are no limits on this route except to be authenticated
Util.ValidateHTTPStatusCode(a, 401);
}
-/*
- if (creds.Password == "INTEGRATION_TEST")
- switch (creds.Login)
- case "EXPIRED":
- exp = new DateTimeOffset(DateTime.Now.AddDays(-30).ToUniversalTime(), TimeSpan.Zero);
- break;
- case "WRONG_ISSUER":
- Issuer = "Bogus";
- break;
- case "NO_ALGORITHM":
- Algorithm = Jose.JwsAlgorithm.none;
- break;
- case "WRONG_SECRET":
- secretKey = System.Text.Encoding.ASCII.GetBytes("xxxxxxThisIsObviouslyWrongxxxxxx");
- break;
+ ///
+ ///
+ ///
+ [Fact]
+ public async void JWTWrongIssuerShouldFail()
+ {
+ ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_ISSUER"));//lowest level test user because there are no limits on this route except to be authenticated
+ Util.ValidateHTTPStatusCode(a, 401);
+ }
+
+ ///
+ ///
+ ///
+ [Fact]
+ public async void JWTNoAlgorithmShouldFail()
+ {
+ ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM"));
+ Util.ValidateHTTPStatusCode(a, 401);
+ }
+
+ ///
+ ///
+ ///
+ [Fact]
+ public async void JWTBadSecretShouldFail()
+ {
+ ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET"));
+ Util.ValidateHTTPStatusCode(a, 401);
+ }
- case "TRUNCATED_SIGNATURE":
- PostTransform = true;
- break;
- case "TRANSPOSE_SIGNATURE":
- PostTransform = true;
- break;
- }
- */
+ ///
+ ///
+ ///
+ [Fact]
+ public async void JWTTruncatedSignatureShouldFail()
+ {
+ ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE"));
+ Util.ValidateHTTPStatusCode(a, 401);
+ }
+
+
+ ///
+ ///
+ ///
+ [Fact]
+ public async void JWTTransposedSignatureShouldFail()
+ {
+ ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE"));
+ Util.ValidateHTTPStatusCode(a, 401);
+ }
+
+
+ /*
+ if (creds.Password == "INTEGRATION_TEST")
+
+ switch (creds.Login)
+ case "EXPIRED":
+ exp = new DateTimeOffset(DateTime.Now.AddDays(-30).ToUniversalTime(), TimeSpan.Zero);
+ break;
+ case "WRONG_ISSUER":
+ Issuer = "Bogus";
+ break;
+ case "NO_ALGORITHM":
+ Algorithm = Jose.JwsAlgorithm.none;
+ break;
+ case "WRONG_SECRET":
+ secretKey = System.Text.Encoding.ASCII.GetBytes("xxxxxxThisIsObviouslyWrongxxxxxx");
+ break;
+
+
+ case "TRUNCATED_SIGNATURE":
+ PostTransform = true;
+ break;
+ case "TRANSPOSE_SIGNATURE":
+ PostTransform = true;
+ break;
+ }
+ */
//==================================================