use of io.syndesis.server.credential.AcquisitionFlow in project syndesis by syndesisio.
the class ConnectorCredentialHandler method create.
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response create(@NotNull @Valid final AcquisitionRequest request, @Context final HttpServletRequest httpRequest) {
final AcquisitionFlow acquisitionFlow = credentials.acquire(connectorId, apiBase(httpRequest), absoluteTo(httpRequest, request.getReturnUrl()));
final CredentialFlowState flowState = acquisitionFlow.state().get();
final NewCookie cookie = state.persist(flowState.persistenceKey(), "/", flowState);
final AcquisitionResponse acquisitionResponse = AcquisitionResponse.Builder.from(acquisitionFlow).state(State.Builder.cookie(cookie.toString())).build();
return Response.accepted().entity(acquisitionResponse).build();
}
Aggregations