* @resource.representation.500 returned if invalid params are provided
*/
@POST
public Response login() {
APIAuthenticationToken apiToken;
try {
apiToken = applicationManager.getSecurityService().issueAuthenticationToken(applicationManager.getSecurityService().getCurrentUser());
} catch (UserNotFoundException e) {
return error(e.getMessage(), Response.status(Response.Status.NOT_FOUND));
} catch (ValidationException e) {
return error(e.getMessage(), Response.status(Response.Status.BAD_REQUEST));
}
// return the token as a custom header value
return Response.ok()
.header(Constants.NODEABLE_AUTH_TOKEN, apiToken.getToken())
.status(Response.Status.NO_CONTENT)
.build();
}