use of net.petafuel.styx.api.v1.preauth.entity.GetPreStepResponse in project styx by petafuel.
the class PreAuthResource method getPreStepAuthentication.
/**
* @param preauthId this id should match a state column within the oauth_sessions table
* @return a GetPreStepResponse Object which contains certain values from an OAuthSession object
*/
@GET
@CheckAccessToken(allowedServices = { XS2ATokenType.AIS, XS2ATokenType.PIS, XS2ATokenType.AISPIS, XS2ATokenType.PIIS })
@Path("/preauth/{preauthId}")
public Response getPreStepAuthentication(@NotBlank @PathParam("preauthId") String preauthId) {
OAuthSession oAuthSession;
try {
oAuthSession = PersistentOAuthSession.getById(UUID.fromString(preauthId));
} catch (PersistenceEmptyResultSetException unknownPreauth) {
throw new StyxException(new ResponseEntity(ResponseConstant.STYX_PREAUTH_NOT_FOUND, ResponseCategory.ERROR, ResponseOrigin.CLIENT));
}
LOG.info("Successfully retrieved preauth from oauth_session state={}", oAuthSession.getState());
return Response.status(ResponseConstant.OK).entity(new GetPreStepResponse(oAuthSession)).build();
}
Aggregations