@Test public void signServiceResponse() { }
@POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod public Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse) { SignaturBiljett signaturBiljett; monitoringLogService.logSignResponseReceived(relayState); String signResponseString = ""; try { signResponseString = new String(Base64.getDecoder().decode(eidSignResponse), StandardCharsets.UTF_8); } catch (Exception e) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Could not decode sign response: " + e.getMessage()); return getRedirectResponseWithReturnUrl(signaturBiljett); } var validationResponse = dssSignMessageService.validateDssMessageSignature(signResponseString); if (!validationResponse.isValid()) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Validation of sign response signature failed!"); return getRedirectResponseWithReturnUrl(signaturBiljett); } signaturBiljett = dssSignatureService.receiveSignResponse(relayState, signResponseString); return getRedirectResponseWithReturnUrl(signaturBiljett); }
SignatureApiController extends AbstractApiController { @POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod public Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse) { SignaturBiljett signaturBiljett; monitoringLogService.logSignResponseReceived(relayState); String signResponseString = ""; try { signResponseString = new String(Base64.getDecoder().decode(eidSignResponse), StandardCharsets.UTF_8); } catch (Exception e) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Could not decode sign response: " + e.getMessage()); return getRedirectResponseWithReturnUrl(signaturBiljett); } var validationResponse = dssSignMessageService.validateDssMessageSignature(signResponseString); if (!validationResponse.isValid()) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Validation of sign response signature failed!"); return getRedirectResponseWithReturnUrl(signaturBiljett); } signaturBiljett = dssSignatureService.receiveSignResponse(relayState, signResponseString); return getRedirectResponseWithReturnUrl(signaturBiljett); } }
SignatureApiController extends AbstractApiController { @POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod public Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse) { SignaturBiljett signaturBiljett; monitoringLogService.logSignResponseReceived(relayState); String signResponseString = ""; try { signResponseString = new String(Base64.getDecoder().decode(eidSignResponse), StandardCharsets.UTF_8); } catch (Exception e) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Could not decode sign response: " + e.getMessage()); return getRedirectResponseWithReturnUrl(signaturBiljett); } var validationResponse = dssSignMessageService.validateDssMessageSignature(signResponseString); if (!validationResponse.isValid()) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Validation of sign response signature failed!"); return getRedirectResponseWithReturnUrl(signaturBiljett); } signaturBiljett = dssSignatureService.receiveSignResponse(relayState, signResponseString); return getRedirectResponseWithReturnUrl(signaturBiljett); }  }
SignatureApiController extends AbstractApiController { @POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod public Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse) { SignaturBiljett signaturBiljett; monitoringLogService.logSignResponseReceived(relayState); String signResponseString = ""; try { signResponseString = new String(Base64.getDecoder().decode(eidSignResponse), StandardCharsets.UTF_8); } catch (Exception e) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Could not decode sign response: " + e.getMessage()); return getRedirectResponseWithReturnUrl(signaturBiljett); } var validationResponse = dssSignMessageService.validateDssMessageSignature(signResponseString); if (!validationResponse.isValid()) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Validation of sign response signature failed!"); return getRedirectResponseWithReturnUrl(signaturBiljett); } signaturBiljett = dssSignatureService.receiveSignResponse(relayState, signResponseString); return getRedirectResponseWithReturnUrl(signaturBiljett); }  @POST @Path("/{intygsTyp}/{intygsId}/{version}/signeringshash/{signMethod}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod SignaturStateDTO signeraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        @PathParam("version") long version, @PathParam("signMethod") String signMethodStr); @POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse); @GET @Path(SIGN_SERVICE_METADATA_PATH) Response signServiceClientMetadata(); @GET @Path("/{intygsTyp}/{ticketId}/signeringsstatus") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) SignaturStateDTO signeringsStatus(@PathParam("intygsTyp") String intygsTyp, @PathParam("ticketId") String ticketId); @POST @Path("/{intygsTyp}/{biljettId}/signeranetidplugin") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM}) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) SignaturStateDTO klientSigneraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("biljettId") String biljettId,
        @Context HttpServletRequest request, KlientSignaturRequest signaturRequest); }
SignatureApiController extends AbstractApiController { @POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod public Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse) { SignaturBiljett signaturBiljett; monitoringLogService.logSignResponseReceived(relayState); String signResponseString = ""; try { signResponseString = new String(Base64.getDecoder().decode(eidSignResponse), StandardCharsets.UTF_8); } catch (Exception e) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Could not decode sign response: " + e.getMessage()); return getRedirectResponseWithReturnUrl(signaturBiljett); } var validationResponse = dssSignMessageService.validateDssMessageSignature(signResponseString); if (!validationResponse.isValid()) { signaturBiljett = dssSignatureService.updateSignatureTicketWithError(relayState); monitoringLogService.logSignResponseInvalid(relayState, signaturBiljett.getIntygsId(), "Validation of sign response signature failed!"); return getRedirectResponseWithReturnUrl(signaturBiljett); } signaturBiljett = dssSignatureService.receiveSignResponse(relayState, signResponseString); return getRedirectResponseWithReturnUrl(signaturBiljett); }  @POST @Path("/{intygsTyp}/{intygsId}/{version}/signeringshash/{signMethod}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod SignaturStateDTO signeraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        @PathParam("version") long version, @PathParam("signMethod") String signMethodStr); @POST @Path(SIGN_SERVICE_RESPONSE_PATH) @PrometheusTimeMethod Response signServiceResponse(@FormParam("RelayState") String relayState, @FormParam("EidSignResponse") String eidSignResponse); @GET @Path(SIGN_SERVICE_METADATA_PATH) Response signServiceClientMetadata(); @GET @Path("/{intygsTyp}/{ticketId}/signeringsstatus") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) SignaturStateDTO signeringsStatus(@PathParam("intygsTyp") String intygsTyp, @PathParam("ticketId") String ticketId); @POST @Path("/{intygsTyp}/{biljettId}/signeranetidplugin") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM}) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) SignaturStateDTO klientSigneraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("biljettId") String biljettId,
        @Context HttpServletRequest request, KlientSignaturRequest signaturRequest); static final String SIGNATUR_API_CONTEXT_PATH; static final String SIGN_SERVICE_RESPONSE_PATH; static final String SIGN_SERVICE_METADATA_PATH; }