/** * Log out user * * @param tokenHeader * @return Response object */ @GET @Path("/logout") @Produces(APPLICATION_JSON) @ApiOperation(value = "Log a user out") @Timed public Response logUserOut( @HeaderParam(AUTHORIZATION) @ApiParam(value = EXAMPLE_AUTHORIZATION_HEADER, required = true) final String tokenHeader) { try { authentication.logOut(tokenHeader); return httpHeader.headers(NO_CONTENT).build(); } catch (Exception exception) { LOGGER.error("logUserOut failed with error:", exception); throw exception; } }
/** * Verify token * * @param tokenHeader * @return Response object */ @GET @Path("/verifyToken") @Produces(APPLICATION_JSON) @ApiOperation(value = "Verify user's authorization") @Timed public Response verifyToken( @HeaderParam(AUTHORIZATION) @ApiParam(value = EXAMPLE_AUTHORIZATION_HEADER, required = true) final String tokenHeader) { try { return httpHeader.headers().entity(authentication.verifyToken(tokenHeader)).build(); } catch (Exception exception) { LOGGER.error("verifyToken failed with error:", exception); throw exception; } }
return httpHeader.headers().entity(authentication.logIn(authorizationHeader)).build(); } catch (Exception exception) { LOGGER.error("logUserIn failed for grantType={} with error:", grantType, exception);
return httpHeader.headers().entity(authentication.getUserExists(userEmail)).build(); } catch (Exception exception) { LOGGER.error("getUserExists failed for userEmail={} with error:", userEmail, exception);