Skip to content

pic sure api war

Bria Morgan edited this page Aug 16, 2018 · 3 revisions

This is where the service layers are located. PicsureRS defines the endpoints available in the PICSURE-2.0 project. The individual service classes fetch any needed data and send the request to the ResourceWebClient.

Each endpoint should be annotated with documentary notes for the swagger.json to describe the endpoint (@ApiOperation) and its parameters (@ApiParam, @PathParam). For example

@Path("/info/{resourceId}")
@ApiOperation(value = "Returns information about the provided resource")
public ResourceInfo resourceInfo(@ApiParam(value="The UUID of the resource to fetch information about") \
@PathParam("resourceId") String resourceId, \
@ApiParam(value="Key-value map, key is identifier for resource, value is token for resource") \
Map<String, String> resourceCredentials)

All calls to the endpoints are intercepted by the JWTFilter, which checks the attached authorization token to see that it matches a user stored in the user database, and that that user has the appropriate permissions. To restrict what roles can access a particular endpoint, use the @RolesAllowed annotation. Possible roles are listed in PicsureNaming.