Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: prevent collision in operation names in IdentityHub management API #288

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
maven/mavencentral/com.apicatalog/carbon-did/0.0.2, Apache-2.0, approved, #9239

Check warning on line 1 in DEPENDENCIES

View workflow job for this annotation

GitHub Actions / check / Dash-Verify-Licenses

Restricted Dependencies found

Some dependencies are marked 'restricted' - please review them
maven/mavencentral/com.apicatalog/iron-verifiable-credentials/0.8.1, Apache-2.0, approved, #9234
maven/mavencentral/com.apicatalog/titanium-json-ld/1.0.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.apicatalog/titanium-json-ld/1.3.1, Apache-2.0, approved, #8912
Expand Down Expand Up @@ -178,9 +178,10 @@
maven/mavencentral/joda-time/joda-time/2.10.5, Apache-2.0, approved, clearlydefined
maven/mavencentral/junit/junit/4.13.2, EPL-2.0, approved, CQ23636
maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.1, Apache-2.0, approved, #7164
maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.11, Apache-2.0, approved, #7164
maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.12, Apache-2.0, approved, #7164
maven/mavencentral/net.bytebuddy/byte-buddy/1.14.1, Apache-2.0 AND BSD-3-Clause, approved, #7163
maven/mavencentral/net.bytebuddy/byte-buddy/1.14.11, Apache-2.0 AND BSD-3-Clause, approved, #7163
maven/mavencentral/net.bytebuddy/byte-buddy/1.14.12, Apache-2.0 AND BSD-3-Clause, approved, #7163
maven/mavencentral/net.java.dev.jna/jna/5.13.0, Apache-2.0 AND LGPL-2.1-or-later, approved, #6709
maven/mavencentral/net.javacrumbs.json-unit/json-unit-core/2.36.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/net.minidev/accessors-smart/2.4.7, Apache-2.0, approved, #7515
Expand Down Expand Up @@ -356,8 +357,8 @@
maven/mavencentral/org.mock-server/mockserver-client-java/5.15.0, Apache-2.0 AND LGPL-3.0-only, approved, #9324
maven/mavencentral/org.mock-server/mockserver-core/5.15.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.mock-server/mockserver-netty/5.15.0, Apache-2.0, approved, #9276
maven/mavencentral/org.mockito/mockito-core/5.11.0, MIT AND (Apache-2.0 AND MIT) AND Apache-2.0, approved, #13505
maven/mavencentral/org.mockito/mockito-core/5.2.0, MIT AND (Apache-2.0 AND MIT) AND Apache-2.0, approved, #7401
maven/mavencentral/org.mockito/mockito-core/5.9.0, MIT AND (Apache-2.0 AND MIT) AND Apache-2.0, approved, #12774
maven/mavencentral/org.mozilla/rhino/1.7.7.2, MPL-2.0 AND BSD-3-Clause AND ISC, approved, CQ16320
maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.opentest4j/opentest4j/1.3.0, Apache-2.0, approved, #9713
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@

@OpenAPIDefinition(
info = @Info(description = "This is the Management API for DID documents", title = "DID Management API", version = "1"))
@Tag(name = "DID")
public interface DidManagementApi {

@Tag(name = "DID Management API")
@Operation(description = "Publish an (existing) DID document. The DID is expected to exist in the database.",
operationId = "publishDid",
parameters = {@Parameter(name = "participantId", description = "Base64-Url encode Participant Context ID", required = true, in = ParameterIn.PATH)},
requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = DidRequestPayload.class), mediaType = "application/json")),
responses = {
Expand All @@ -52,8 +53,8 @@ public interface DidManagementApi {
)
void publishDid(DidRequestPayload didRequestPayload, SecurityContext securityContext);

@Tag(name = "DID Management API")
@Operation(description = "Un-Publish an (existing) DID document. The DID is expected to exist in the database.",
operationId = "unpublishDid",
parameters = {@Parameter(name = "participantId", description = "Base64-Url encode Participant Context ID", required = true, in = ParameterIn.PATH)},
requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = DidRequestPayload.class), mediaType = "application/json")),
responses = {
Expand All @@ -66,10 +67,10 @@ public interface DidManagementApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json"))
}
)
void unpublishDidFromBody(DidRequestPayload didRequestPayload, SecurityContext securityContext);
void unpublishDid(DidRequestPayload didRequestPayload, SecurityContext securityContext);

@Tag(name = "DID Management API")
@Operation(description = "Query for DID documents..",
@Operation(description = "Query for DID documents.",
operationId = "queryDids",
parameters = {@Parameter(name = "participantId", description = "Base64-Url encode Participant Context ID", required = true, in = ParameterIn.PATH)},
requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = QuerySpec.class), mediaType = "application/json")),
responses = {
Expand All @@ -81,10 +82,10 @@ public interface DidManagementApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json")),
}
)
Collection<DidDocument> queryDid(QuerySpec querySpec, SecurityContext securityContext);
Collection<DidDocument> queryDids(QuerySpec querySpec, SecurityContext securityContext);

@Tag(name = "DID Management API")
@Operation(description = "Get state of a DID document",
operationId = "getDidState",
parameters = {@Parameter(name = "participantId", description = "Base64-Url encode Participant Context ID", required = true, in = ParameterIn.PATH)},
requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = DidRequestPayload.class), mediaType = "application/json")),
responses = {
Expand All @@ -95,10 +96,10 @@ public interface DidManagementApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json")),
}
)
String getState(DidRequestPayload request, SecurityContext securityContext);
String getDidState(DidRequestPayload request, SecurityContext securityContext);

@Tag(name = "DID Management API")
@Operation(description = "Adds a service endpoint to a particular DID document.",
operationId = "addDidEndpoint",
requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = Service.class), mediaType = "application/json")),
parameters = {
@Parameter(name = "autoPublish", description = "Whether the DID should get republished after the removal. Defaults to false."),
Expand All @@ -114,10 +115,10 @@ public interface DidManagementApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json"))
}
)
void addEndpoint(String did, Service service, boolean autoPublish, SecurityContext securityContext);
void addDidEndpoint(String did, Service service, boolean autoPublish, SecurityContext securityContext);

@Tag(name = "DID Management API")
@Operation(description = "Replaces a service endpoint of a particular DID document.",
operationId = "replaceDidEndpoint",
requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = Service.class), mediaType = "application/json")),
parameters = {
@Parameter(name = "autoPublish", description = "Whether the DID should get republished after the removal. Defaults to false."),
Expand All @@ -133,10 +134,10 @@ public interface DidManagementApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json"))
}
)
void replaceEndpoint(String did, Service service, boolean autoPublish, SecurityContext securityContext);
void replaceDidEndpoint(String did, Service service, boolean autoPublish, SecurityContext securityContext);

@Tag(name = "DID Management API")
@Operation(description = "Removes a service endpoint from a particular DID document.",
operationId = "deleteDidEndpoint",
parameters = {
@Parameter(name = "serviceId", description = "The ID of the service that should get removed"),
@Parameter(name = "autoPublish", description = "Whether the DID should " + "get republished after the removal. Defaults to false."),
Expand All @@ -152,6 +153,6 @@ public interface DidManagementApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json"))
}
)
void removeEndpoint(String did, String serviceId, boolean autoPublish, SecurityContext securityContext);
void deleteDidEndpoint(String did, String serviceId, boolean autoPublish, SecurityContext securityContext);

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void publishDid(DidRequestPayload didRequestPayload, @Context SecurityCon
@Override
@POST
@Path("/unpublish")
public void unpublishDidFromBody(DidRequestPayload didRequestPayload, @Context SecurityContext securityContext) {
public void unpublishDid(DidRequestPayload didRequestPayload, @Context SecurityContext securityContext) {
authorizationService.isAuthorized(securityContext, didRequestPayload.did(), DidResource.class)
.compose(u -> documentService.unpublish(didRequestPayload.did()))
.orElseThrow(exceptionMapper(DidDocument.class, didRequestPayload.did()));
Expand All @@ -73,7 +73,7 @@ public void unpublishDidFromBody(DidRequestPayload didRequestPayload, @Context S
@POST
@Path("/query")
@Override
public Collection<DidDocument> queryDid(QuerySpec querySpec, @Context SecurityContext securityContext) {
public Collection<DidDocument> queryDids(QuerySpec querySpec, @Context SecurityContext securityContext) {
return documentService.queryDocuments(querySpec)
.orElseThrow(exceptionMapper(DidDocument.class, null))
.stream().filter(dd -> authorizationService.isAuthorized(securityContext, dd.getId(), DidResource.class).succeeded())
Expand All @@ -83,7 +83,7 @@ public Collection<DidDocument> queryDid(QuerySpec querySpec, @Context SecurityCo
@Override
@POST
@Path("/state")
public String getState(DidRequestPayload request, @Context SecurityContext securityContext) {
public String getDidState(DidRequestPayload request, @Context SecurityContext securityContext) {
authorizationService.isAuthorized(securityContext, request.did(), DidResource.class)
.orElseThrow(exceptionMapper(DidResource.class, request.did()));
var byId = documentService.findById(request.did());
Expand All @@ -93,8 +93,8 @@ public String getState(DidRequestPayload request, @Context SecurityContext secur
@Override
@POST
@Path("/{did}/endpoints")
public void addEndpoint(@PathParam("did") String did, Service service, @QueryParam("autoPublish") boolean autoPublish,
@Context SecurityContext securityContext) {
public void addDidEndpoint(@PathParam("did") String did, Service service, @QueryParam("autoPublish") boolean autoPublish,
@Context SecurityContext securityContext) {
authorizationService.isAuthorized(securityContext, did, DidResource.class)
.compose(u -> documentService.addService(did, service))
.compose(v -> autoPublish ? documentService.publish(did) : ServiceResult.success())
Expand All @@ -104,8 +104,8 @@ public void addEndpoint(@PathParam("did") String did, Service service, @QueryPar
@Override
@PATCH
@Path("/{did}/endpoints")
public void replaceEndpoint(@PathParam("did") String did, Service service, @QueryParam("autoPublish") boolean autoPublish,
@Context SecurityContext securityContext) {
public void replaceDidEndpoint(@PathParam("did") String did, Service service, @QueryParam("autoPublish") boolean autoPublish,
@Context SecurityContext securityContext) {
authorizationService.isAuthorized(securityContext, did, DidResource.class)
.compose(u -> documentService.replaceService(did, service))
.compose(v -> autoPublish ? documentService.publish(did) : ServiceResult.success())
Expand All @@ -115,8 +115,8 @@ public void replaceEndpoint(@PathParam("did") String did, Service service, @Quer
@Override
@DELETE
@Path("/{did}/endpoints")
public void removeEndpoint(@PathParam("did") String did, @QueryParam("serviceId") String serviceId, @QueryParam("autoPublish") boolean autoPublish,
@Context SecurityContext securityContext) {
public void deleteDidEndpoint(@PathParam("did") String did, @QueryParam("serviceId") String serviceId, @QueryParam("autoPublish") boolean autoPublish,
@Context SecurityContext securityContext) {
authorizationService.isAuthorized(securityContext, did, DidResource.class)
.compose(u -> documentService.removeService(did, serviceId))
.compose(v -> autoPublish ? documentService.publish(did) : ServiceResult.success())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

@OpenAPIDefinition(
info = @Info(description = "This is the Management API for DID documents", title = "DID Management API", version = "1"))
@Tag(name = "DID")
public interface GetAllDidsApi {

@Tag(name = "DID Management API")

@Operation(description = "Get all DID documents across all Participant Contexts. Requires elevated access.",
operationId = "getAllDids",
parameters = {
@Parameter(name = "offset", description = "the paging offset. defaults to 0"),
@Parameter(name = "limit", description = "the page size. defaults to 50")},
Expand All @@ -46,5 +48,5 @@ public interface GetAllDidsApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json")),
}
)
Collection<DidDocument> getAll(Integer offset, Integer limit);
Collection<DidDocument> getAllDids(Integer offset, Integer limit);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public GetAllDidsApiController(DidDocumentService documentService) {
@Override
@GET
@RolesAllowed(ServicePrincipal.ROLE_ADMIN)
public Collection<DidDocument> getAll(@DefaultValue("0") @QueryParam("offset") Integer offset,
@DefaultValue("50") @QueryParam("limit") Integer limit) {
public Collection<DidDocument> getAllDids(@DefaultValue("0") @QueryParam("offset") Integer offset,
@DefaultValue("50") @QueryParam("limit") Integer limit) {
if (offset < 0 || limit < 0) {
throw new InvalidRequestException("offset and limit must be > 0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

package org.eclipse.edc.identityhub.api.keypair.v1;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -26,10 +28,14 @@

import java.util.Collection;


@OpenAPIDefinition(info = @Info(description = "This is the Management API for KeyPairResources", title = "KeyPairResources Management API", version = "1"))
@Tag(name = "Key Pairs")
public interface GetAllKeyPairsApi {

@Tag(name = "KeyPairResources Management API")

@Operation(description = "Get all KeyPair resources across all Participant Contexts. Requires elevated access.",
operationId = "getAllKeyPairs",
parameters = {
@Parameter(name = "offset", description = "the paging offset. defaults to 0"),
@Parameter(name = "limit", description = "the page size. defaults to 50")},
Expand All @@ -42,5 +48,5 @@ public interface GetAllKeyPairsApi {
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiErrorDetail.class)), mediaType = "application/json")),
}
)
Collection<KeyPairResource> getAll(Integer offset, Integer limit);
Collection<KeyPairResource> getAllKeyPairs(Integer offset, Integer limit);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public GetAllKeyPairsApiController(KeyPairService keyPairService) {
@GET
@RolesAllowed(ServicePrincipal.ROLE_ADMIN)
@Override
public Collection<KeyPairResource> getAll(@DefaultValue("0") @QueryParam("offset") Integer offset,
@DefaultValue("50") @QueryParam("limit") Integer limit) {
public Collection<KeyPairResource> getAllKeyPairs(@DefaultValue("0") @QueryParam("offset") Integer offset,
@DefaultValue("50") @QueryParam("limit") Integer limit) {
return keyPairService.query(QuerySpec.Builder.newInstance().offset(offset).limit(limit).build())
.orElseThrow(exceptionMapper(KeyPairResource.class));
}
Expand Down
Loading
Loading