Added revocation list tests

This commit is contained in:
Xavi Aracil 2022-12-12 17:19:26 +01:00
parent caea0b50f4
commit ed74e2a60d
14 changed files with 102 additions and 2 deletions

View File

@ -97,6 +97,24 @@ public class OB20Tests {
}); });
} }
@Test
void testJWTNotRevoked() {
assertDoesNotThrow(()->{
Report report = validator.run(Samples.OB20.JWT.SIMPLE_NOT_REVOKED_JWT.asFileResource());
if(verbose) PrintHelper.print(report, true);
assertValid(report);
});
}
@Test
void testJWTRevoked() {
assertDoesNotThrow(()->{
Report report = validator.run(Samples.OB20.JWT.SIMPLE_REVOKED_JWT.asFileResource());
if(verbose) PrintHelper.print(report, true);
assertInvalid(report);
});
}
@Test @Test
void testLanguageInBadgeClass() { void testLanguageInBadgeClass() {
assertDoesNotThrow(()->{ assertDoesNotThrow(()->{

View File

@ -91,7 +91,12 @@ public class Samples {
} }
public static final class JWT { public static final class JWT {
// original: test_signed_verification: test_can_full_verify_jws_signed_assertion
public final static Sample SIMPLE_JWT = new Sample("ob20/simple.jwt", true); public final static Sample SIMPLE_JWT = new Sample("ob20/simple.jwt", true);
// original: test_signed_verification: test_can_full_verify_with_revocation_check
public final static Sample SIMPLE_NOT_REVOKED_JWT = new Sample("ob20/simple-not-revoked.jwt", true);
// original: test_signed_verification: test_revoked_badge_marked_invalid
public final static Sample SIMPLE_REVOKED_JWT = new Sample("ob20/simple-revoked.jwt", true);
} }
} }
} }

View File

@ -0,0 +1,10 @@
{
"@context": "https://w3id.org/openbadges/v2",
"type": "BadgeClass",
"id": "https://example.org/badge-from-organization-with-empty-revocation-list.json",
"name": "Awesome Robotics Badge",
"description": "For doing awesome things with robots that people think is pretty great.",
"image": "https://example.org/robotics-badge.png",
"criteria": "http://example.com/badgecriteria.json",
"issuer": "https://example.org/organization-with-empty-revocation-list.json"
}

View File

@ -0,0 +1,10 @@
{
"@context": "https://w3id.org/openbadges/v2",
"type": "BadgeClass",
"id": "https://example.org/badge-from-organization-with-revocation-list.json",
"name": "Awesome Robotics Badge",
"description": "For doing awesome things with robots that people think is pretty great.",
"image": "https://example.org/robotics-badge.png",
"criteria": "http://example.com/badgecriteria.json",
"issuer": "https://example.org/organization-with-revocation-list.json"
}

View File

@ -0,0 +1,6 @@
{
"@context": "https://w3id.org/openbadges/v2",
"id": "http://example.org/empty-revocation-list.json",
"type": "RevocationList",
"revokedAssertions": []
}

View File

@ -3,5 +3,5 @@
"id": "http://example.org/key1.json", "id": "http://example.org/key1.json",
"type": "CryptographicKey", "type": "CryptographicKey",
"owner": "https://example.org/organization.json", "owner": "https://example.org/organization.json",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq/tyy5CGrCVfGIMrMkVq\nZ5cAKkbLdrNrNFvXNMSazvKj/9VmuALZOjqXl1Od/Ku6q+18sn70p6r25kGRoaU/\nAJNLt36EnRSs9I66xZ3tOY4c9PeWpMC1XbCrUBh1rpx7XQ5wULOMbttEvBf9V2Cl\nCGiNqwqcafrQHoYteAtF4d2zcjNm+xZRQmnVU0CdvXSXeniWjqyif/751/M/xb93\nfeF1AIFS5IGaI1cWca7BG2izKz1DjZxbMlvQVZk1Axz2Uj/FXssyBKmAdCw4EjuF\nqinQBmKwmFvCB3yhMAK6+f1k4hsR/ET/PxwkNQZfu+gkmEAQoYAMSPgGS3xY3LVf\nxwIDAQAB\n-----END PUBLIC KEY-----" "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAko9t/QZEwRUainRO5MqY\nGBBeFe7rm/BVg6ugkgkyRGdDkjCeEjNfCm6An+bQqeCsHoMCprs629/a9yJ58/4w\nP7ws/5lJ9YwZYXpGvLfha0xrpWl5DiExeOMB9pB8p4ze0AI6H49w9ZX0G+cgaqaK\n/FbQ/Ln1zkZH6+VaAntoaLu3I5kLLR1F31HqLmSKpm6rHyLFkq534dGfuNmjSM+x\nZxBKu+ugmyeL9DinHvBZ/dwFMGS+o4/bT54UeLMd7a71ONevRY2hXgwarfWjqkDs\nAgqnfKSDjjDZQDM2OlyLWvyI2SWF4eWxIUtWuFP4j0d/5SUFjhAldRLjIXMQWMEN\nNwIDAQAB\n-----END PUBLIC KEY-----"
} }

View File

@ -0,0 +1,7 @@
{
"@context": "https://w3id.org/openbadges/v2",
"id": "http://example.org/key2.json",
"type": "CryptographicKey",
"owner": "https://example.org/organization-with-empty-revocation-list.json",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjjtSHqVnCOhOe91mt1hh\nWa0h6qF5K32ETY3+6ENQ7kR6qvI1S4prxptYfkuCncJFeZkCu306QS8E/iYCUEoC\ndKOYMVtn1Tm16p2cD+d4LQNYDQbKyKIqU8Cgqb3GoS2MWlJ6Q9sVW1B24RYAokW9\npm80xFJMJAIbZKBfr/hMLofGD5vvBHV/UFYtGvy7PByA7eNPkSLFnIY2L6WBWVyE\na2o95Jzvih+H2CmAk6HSumJL/PdV3yys/m4TEmU0V3m7B8voa3yEIFYG4hKxGUCi\nRqaq/wTFsTVBsEZn9rcpjG58ibjfd1+HBhWjRqsa5NNM9sQqnvvNBSWnqE5ggiNc\nzQIDAQAB\n-----END PUBLIC KEY-----"
}

View File

@ -0,0 +1,7 @@
{
"@context": "https://w3id.org/openbadges/v2",
"id": "http://example.org/key3.json",
"type": "CryptographicKey",
"owner": "https://example.org/organization-with-revocation-list.json",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlxjYVv/2hAXO/D9b/Ifq\ng4n8TQCG3tq6JUyQPrhW27E9htH5UexdbOAAlzydQ5kYve3F8fhHuue/mjnKrMJn\najdTU4BBIPT4CJ3ZCCzKZf9OvMwobZT5P5QmkG1eVLOTGFs9BTvpbGQ7qugUbxHH\nXeHK/OoBnenKmLV0R4+KePe0oTcNToDQbx0uMZzNM9TRpnVBHlCXwYbFzw1js0Tt\nuT4M8MtKOoyNf+ZA8fcsSpmE7K1xDYOY7o9tZMFtGIQuhKlZyVpKpAu4KrhrZBJG\nJ47zcxzrncQHmft3aL8qWNCtZ+fOa+/fPkjT+bPhCwHSkE9Xj8Q0AF1vmDNReun1\nhwIDAQAB\n-----END PUBLIC KEY-----"
}

View File

@ -0,0 +1,10 @@
{
"@context": "https://w3id.org/openbadges/v2",
"type": "Issuer",
"id": "https://example.org/organization-with-empty-revocation-list.json",
"name": "An Example Badge Issuer",
"url": "https://example.org",
"email": "contact@example.org",
"revocationList": "http://example.org/empty-revocation-list.json",
"publicKey": "http://example.org/key2.json"
}

View File

@ -0,0 +1,10 @@
{
"@context": "https://w3id.org/openbadges/v2",
"type": "Issuer",
"id": "https://example.org/organization-with-revocation-list.json",
"name": "An Example Badge Issuer",
"url": "https://example.org",
"email": "contact@example.org",
"revocationList": "http://example.org/revocation-list.json",
"publicKey": "http://example.org/key3.json"
}

View File

@ -0,0 +1,15 @@
{
"@context": "https://w3id.org/openbadges/v2",
"id": "http://example.org/revocation-list.json",
"type": "RevocationList",
"revokedAssertions": [
{
"id": "https://example.org/beths-robotics-badge-revoked.json",
"revocationReason": "A good reason, for sure"
},
{
"id": "urn:uuid:52e4c6b3-8c13-4fa8-8482-a5cf34ef37a9"
},
"urn:uuid:6deb4a00-ebce-4b28-8cc2-afa705ef7be4"
]
}

View File

@ -0,0 +1 @@
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJAY29udGV4dCI6Imh0dHBzOi8vdzNpZC5vcmcvb3BlbmJhZGdlcy92MiIsInR5cGUiOiJBc3NlcnRpb24iLCJpZCI6Imh0dHBzOi8vZXhhbXBsZS5vcmcvYmV0aHMtcm9ib3RpY3MtYmFkZ2UuanNvbiIsInJlY2lwaWVudCI6eyJ0eXBlIjoiZW1haWwiLCJoYXNoZWQiOnRydWUsInNhbHQiOiJkZWFkc2VhIiwiaWRl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