我有这样的 API
@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);
}
一个参数是 Jersey SecurityContext。我的问题是,我能用这个安全上下文做什么?对这个 api 的请求是什么样的?
我已阅读此https://jersey.java.net/documentation/latest/security.html但我根本没有完全了解 SecurityContext。
Wished Behavior 将发送两个信息作为字符串,如用户和键(如果可能)。