Jersey SecurityContext for what is it good, and how to use it?

869 Views Asked by At

I have an API like this

@GET
@Path("/tasks")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "List all tasks", notes = "", response = Tasks.class, authorizations = {
@io.swagger.annotations.Authorization(value = "api_key")
}, tags={ "tasks",  })
@io.swagger.annotations.ApiResponses(value = { 
@io.swagger.annotations.ApiResponse(code = 200, message = "An array of tasks", response = Tasks.class),
@io.swagger.annotations.ApiResponse(code = 200, message = "unexpected error", response = Tasks.class) })
public Response getTasks(@Context SecurityContext securityContext) throws NotFoundException {
    return delegate.getTasks(securityContext);
}

A parameter is Jersey SecurityContext. My question is, What can i do with this securitycontext? And how has a request to this api look like?

I have read this https://jersey.java.net/documentation/latest/security.html but i didn't get a full understanding of the SecurityContext at all.

Wished Behaviour would be send two informations as strings like a user and a key if it is possible.

0

There are 0 best solutions below