Skip to content

Commit

Permalink
chore: downgrade Management API version to /v1alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed May 22, 2024
1 parent a188d79 commit d3495c4
Show file tree
Hide file tree
Showing 31 changed files with 128 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void publishDid_notOwner_expect403() {
"did": "did:web:user1"
}
""")
.post("/v1/participants/%s/dids/publish".formatted(user1))
.post("/v1alpha/participants/%s/dids/publish".formatted(user1))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand Down Expand Up @@ -97,7 +97,7 @@ void publishDid() {
"did": "did:web:test-user"
}
""")
.post("/v1/participants/%s/dids/publish".formatted(user))
.post("/v1alpha/participants/%s/dids/publish".formatted(user))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand Down Expand Up @@ -144,7 +144,7 @@ void unpublishDid_notOwner_expect403() {
"did": "did:web:user1"
}
""")
.post("/v1/participants/%s/dids/unpublish".formatted(user1))
.post("/v1alpha/participants/%s/dids/unpublish".formatted(user1))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand Down Expand Up @@ -173,7 +173,7 @@ void unpublishDid() {
"did": "did:web:test-user"
}
""")
.post("/v1/participants/%s/dids/unpublish".formatted(user))
.post("/v1alpha/participants/%s/dids/unpublish".formatted(user))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand Down Expand Up @@ -206,7 +206,7 @@ void getState_nowOwner_expect403() {
"did": "did:web:user1"
}
""")
.post("/v1/participants/%s/dids/state".formatted(user1))
.post("/v1alpha/participants/%s/dids/state".formatted(user1))
.then()
.log().ifValidationFails()
.statusCode(403);
Expand All @@ -220,7 +220,7 @@ void getAll() {
var docs = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/dids")
.get("/v1alpha/dids")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -237,7 +237,7 @@ void getAll_withDefaultPaging() {
var docs = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/dids")
.get("/v1alpha/dids")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -254,7 +254,7 @@ void getAll_withPaging() {
var docs = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/dids?offset=5&limit=10")
.get("/v1alpha/dids?offset=5&limit=10")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -271,7 +271,7 @@ void getAll_notAuthorized() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", attackerToken))
.get("/v1/dids")
.get("/v1alpha/dids")
.then()
.log().ifValidationFails()
.statusCode(403);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void findById_notAuthorized() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", user2Token))
.get("/v1/participants/%s/keypairs/%s".formatted(toBase64(user1), key))
.get("/v1alpha/participants/%s/keypairs/%s".formatted(toBase64(user1), key))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand All @@ -95,7 +95,7 @@ void findById() {
.allSatisfy(t -> RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", t))
.get("/v1/participants/%s/keypairs/%s".formatted(toBase64(user1), key))
.get("/v1alpha/participants/%s/keypairs/%s".formatted(toBase64(user1), key))
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -122,7 +122,7 @@ void findForParticipant_notAuthorized() {
var res = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", user2Token))
.get("/v1/participants/%s/keypairs".formatted(toBase64(user1)))
.get("/v1alpha/participants/%s/keypairs".formatted(toBase64(user1)))
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -143,7 +143,7 @@ void findForParticipant() {
.allSatisfy(t -> RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", t))
.get("/v1/participants/%s/keypairs".formatted(toBase64(user1)))
.get("/v1alpha/participants/%s/keypairs".formatted(toBase64(user1)))
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -167,7 +167,7 @@ void addKeyPair() {
.contentType(JSON)
.header(new Header("x-api-key", t))
.body(keyDesc)
.put("/v1/participants/%s/keypairs".formatted(toBase64(user1)))
.put("/v1alpha/participants/%s/keypairs".formatted(toBase64(user1)))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand Down Expand Up @@ -198,7 +198,7 @@ void addKeyPair_notAuthorized() {
.contentType(JSON)
.header(new Header("x-api-key", token2))
.body(keyDesc)
.put("/v1/participants/%s/keypairs".formatted(toBase64(user1)))
.put("/v1alpha/participants/%s/keypairs".formatted(toBase64(user1)))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand Down Expand Up @@ -233,7 +233,7 @@ void rotate() {
.contentType(JSON)
.header(new Header("x-api-key", t))
.body(keyDesc)
.post("/v1/participants/%s/keypairs/%s/rotate".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/rotate".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand Down Expand Up @@ -275,7 +275,7 @@ void rotate_notAuthorized() {
.contentType(JSON)
.header(new Header("x-api-key", token2))
.body(keyDesc)
.post("/v1/participants/%s/keypairs/%s/rotate".formatted(user1, keyId))
.post("/v1alpha/participants/%s/keypairs/%s/rotate".formatted(user1, keyId))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand Down Expand Up @@ -305,7 +305,7 @@ void revoke() {
.contentType(JSON)
.header(new Header("x-api-key", t))
.body(keyDesc)
.post("/v1/participants/%s/keypairs/%s/revoke".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/revoke".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand All @@ -332,7 +332,7 @@ void revoke_notAuthorized() {
.contentType(JSON)
.header(new Header("x-api-key", token2))
.body(keyDesc)
.post("/v1/participants/%s/keypairs/%s/revoke".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/revoke".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand All @@ -350,7 +350,7 @@ void getAll() {
var found = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/keypairs")
.get("/v1alpha/keypairs")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -369,7 +369,7 @@ void getAll_withPaging() {
var found = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/keypairs?offset=2&limit=4")
.get("/v1alpha/keypairs?offset=2&limit=4")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -388,7 +388,7 @@ void getAll_withDefaultPaging() {
var found = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/keypairs")
.get("/v1alpha/keypairs")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -408,7 +408,7 @@ void getAll_notAuthorized() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", attackerToken))
.get("/v1/keypairs")
.get("/v1alpha/keypairs")
.then()
.log().ifValidationFails()
.statusCode(403);
Expand All @@ -426,7 +426,7 @@ void activate() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", t))
.post("/v1/participants/%s/keypairs/%s/activate".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/activate".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand All @@ -448,7 +448,7 @@ void activate_notAuthorized() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", attackerToken))
.post("/v1/participants/%s/keypairs/%s/activate".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/activate".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(403)
Expand All @@ -469,7 +469,7 @@ void activate_illegalState() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", token))
.post("/v1/participants/%s/keypairs/%s/revoke".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/revoke".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(204)
Expand All @@ -479,7 +479,7 @@ void activate_illegalState() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", token))
.post("/v1/participants/%s/keypairs/%s/activate".formatted(toBase64(user1), keyId))
.post("/v1alpha/participants/%s/keypairs/%s/activate".formatted(toBase64(user1), keyId))
.then()
.log().ifValidationFails()
.statusCode(400)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void getUserById() {

var su = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.header(new Header("x-api-key", apikey))
.get("/v1/participants/" + toBase64(SUPER_USER))
.get("/v1alpha/participants/" + toBase64(SUPER_USER))
.then()
.statusCode(200)
.extract().body().as(ParticipantContext.class);
Expand Down Expand Up @@ -85,7 +85,7 @@ void getUserById_notOwner_expect403() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.header(new Header("x-api-key", apiToken1))
.contentType(ContentType.JSON)
.get("/v1/participants/" + toBase64(user2))
.get("/v1alpha/participants/" + toBase64(user2))
.then()
.log().ifValidationFails()
.statusCode(403);
Expand All @@ -103,7 +103,7 @@ void createNewUser_principalIsSuperser() {
.header(new Header("x-api-key", apikey))
.contentType(ContentType.JSON)
.body(manifest)
.post("/v1/participants/")
.post("/v1alpha/participants/")
.then()
.log().ifError()
.statusCode(anyOf(equalTo(200), equalTo(204)))
Expand Down Expand Up @@ -134,7 +134,7 @@ void createNewUser_verifyKeyPairActive(boolean isActive) {
.header(new Header("x-api-key", apikey))
.contentType(ContentType.JSON)
.body(manifest)
.post("/v1/participants/")
.post("/v1alpha/participants/")
.then()
.log().ifError()
.statusCode(anyOf(equalTo(200), equalTo(204)))
Expand Down Expand Up @@ -168,7 +168,7 @@ void createNewUser_principalIsNotSuperuser_expect403() {
.header(new Header("x-api-key", apiToken))
.contentType(ContentType.JSON)
.body(manifest)
.post("/v1/participants/")
.post("/v1alpha/participants/")
.then()
.log().ifError()
.statusCode(403)
Expand All @@ -190,7 +190,7 @@ void createNewUser_principalIsKnown_expect401() {
.header(new Header("x-api-key", createTokenFor(principal)))
.contentType(ContentType.JSON)
.body(manifest)
.post("/v1/participants/")
.post("/v1alpha/participants/")
.then()
.log().ifError()
.statusCode(401)
Expand All @@ -217,7 +217,7 @@ void activateParticipant_principalIsSuperser() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.header(new Header("x-api-key", superUserKey))
.contentType(ContentType.JSON)
.post("/v1/participants/%s/state?isActive=true".formatted(toBase64(participantId)))
.post("/v1alpha/participants/%s/state?isActive=true".formatted(toBase64(participantId)))
.then()
.log().ifError()
.statusCode(204);
Expand All @@ -243,7 +243,7 @@ void deleteParticipant() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.header(new Header("x-api-key", superUserKey))
.contentType(ContentType.JSON)
.delete("/v1/participants/%s".formatted(toBase64(participantId)))
.delete("/v1alpha/participants/%s".formatted(toBase64(participantId)))
.then()
.log().ifError()
.statusCode(204);
Expand All @@ -261,7 +261,7 @@ void regenerateToken() {
.allSatisfy(t -> RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.header(new Header("x-api-key", t))
.contentType(ContentType.JSON)
.post("/v1/participants/%s/token".formatted(toBase64(participantId)))
.post("/v1alpha/participants/%s/token".formatted(toBase64(participantId)))
.then()
.log().ifError()
.statusCode(200)
Expand All @@ -278,7 +278,7 @@ void updateRoles() {
.header(new Header("x-api-key", superUserKey))
.contentType(ContentType.JSON)
.body(List.of("role1", "role2", "admin"))
.put("/v1/participants/%s/roles".formatted(toBase64(participantId)))
.put("/v1alpha/participants/%s/roles".formatted(toBase64(participantId)))
.then()
.log().ifError()
.statusCode(204);
Expand All @@ -296,7 +296,7 @@ void updateRoles_whenNotSuperuser(String role) {
.header(new Header("x-api-key", userToken))
.contentType(ContentType.JSON)
.body(List.of(role))
.put("/v1/participants/%s/roles".formatted(toBase64(participantId)))
.put("/v1alpha/participants/%s/roles".formatted(toBase64(participantId)))
.then()
.log().ifError()
.statusCode(403);
Expand All @@ -313,7 +313,7 @@ void getAll() {
var found = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/participants")
.get("/v1alpha/participants")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -332,7 +332,7 @@ void getAll_withPaging() {
var found = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/participants?offset=2&limit=4")
.get("/v1alpha/participants?offset=2&limit=4")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -351,7 +351,7 @@ void getAll_withDefaultPaging() {
var found = RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", superUserKey))
.get("/v1/participants")
.get("/v1alpha/participants")
.then()
.log().ifValidationFails()
.statusCode(200)
Expand All @@ -371,7 +371,7 @@ void getAll_notAuthorized() {
RUNTIME_CONFIGURATION.getManagementEndpoint().baseRequest()
.contentType(JSON)
.header(new Header("x-api-key", attackerToken))
.get("/v1/participants")
.get("/v1alpha/participants")
.then()
.log().ifValidationFails()
.statusCode(403);
Expand Down
Loading

0 comments on commit d3495c4

Please sign in to comment.