Search in sources :

Example 1 with AcquisitionFlow

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();
}
Also used : AcquisitionResponse(io.syndesis.server.credential.AcquisitionResponse) AcquisitionFlow(io.syndesis.server.credential.AcquisitionFlow) CredentialFlowState(io.syndesis.server.credential.CredentialFlowState) NewCookie(javax.ws.rs.core.NewCookie) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Aggregations

AcquisitionFlow (io.syndesis.server.credential.AcquisitionFlow)1 AcquisitionResponse (io.syndesis.server.credential.AcquisitionResponse)1 CredentialFlowState (io.syndesis.server.credential.CredentialFlowState)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 NewCookie (javax.ws.rs.core.NewCookie)1