use of se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse in project webcert by sklintyg.
the class UtkastModuleApiController method signeraUtkast.
/**
* Skapa signeringshash.
*
* @param intygsId intyg id
* @return SignaturTicketResponse
*/
@POST
@Path("/{intygsTyp}/{intygsId}/{version}/signeringshash")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public SignaturTicketResponse signeraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId, @PathParam("version") long version) {
authoritiesValidator.given(getWebCertUserService().getUser(), intygsTyp).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow();
SignaturTicket ticket;
try {
ticket = signaturService.createDraftHash(intygsId, version);
} catch (OptimisticLockException | OptimisticLockingFailureException e) {
monitoringLogService.logUtkastConcurrentlyEdited(intygsId, intygsTyp);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.CONCURRENT_MODIFICATION, e.getMessage());
}
return new SignaturTicketResponse(ticket);
}
use of se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse in project webcert by sklintyg.
the class UtkastModuleApiController method biljettStatus.
/**
* Hamta signeringsstatus.
*
* @param biljettId biljett id
* @return SignaturTicketResponse
*/
@GET
@Path("/{intygsTyp}/{biljettId}/signeringsstatus")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public SignaturTicketResponse biljettStatus(@PathParam("intygsTyp") String intygsTyp, @PathParam("biljettId") String biljettId) {
authoritiesValidator.given(getWebCertUserService().getUser(), intygsTyp).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow();
SignaturTicket ticket = signaturService.ticketStatus(biljettId);
return new SignaturTicketResponse(ticket);
}
use of se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse in project webcert by sklintyg.
the class UtkastModuleApiController method klientSigneraUtkast.
/**
* Signera utkast.
*
* @param biljettId biljett id
* @return BiljettResponse
*/
@POST
@Path("/{intygsTyp}/{biljettId}/signeraklient")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public SignaturTicketResponse klientSigneraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("biljettId") String biljettId, @Context HttpServletRequest request, byte[] rawSignatur) {
verifyIsAuthorizedToSignIntyg(intygsTyp);
LOG.debug("Signerar intyg med biljettId {}", biljettId);
if (rawSignatur.length == 0) {
LOG.error("Inkommande signatur parameter saknas");
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Signatur saknas");
}
String rawSignaturString = fromBytesToString(rawSignatur);
SignaturTicket ticket;
try {
ticket = signaturService.clientSignature(biljettId, rawSignaturString);
} catch (OptimisticLockException | OptimisticLockingFailureException e) {
ticket = signaturService.ticketStatus(biljettId);
monitoringLogService.logUtkastConcurrentlyEdited(ticket.getIntygsId(), intygsTyp);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.CONCURRENT_MODIFICATION, e.getMessage());
}
request.getSession(true).removeAttribute(LAST_SAVED_DRAFT);
return new SignaturTicketResponse(ticket);
}
use of se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse in project webcert by sklintyg.
the class UtkastModuleApiController method serverSigneraUtkastMedGrp.
/**
* Signera utkast mha Bank ID GRP API.
*
* @param intygsId intyg id
* @return SignaturTicketResponse
*/
@POST
@Path("/{intygsTyp}/{intygsId}/{version}/grp/signeraserver")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public SignaturTicketResponse serverSigneraUtkastMedGrp(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId, @PathParam("version") long version, @Context HttpServletRequest request) {
verifyIsAuthorizedToSignIntyg(intygsTyp);
SignaturTicket ticket;
try {
ticket = grpSignaturService.startGrpAuthentication(intygsId, version);
} catch (OptimisticLockException | OptimisticLockingFailureException e) {
monitoringLogService.logUtkastConcurrentlyEdited(intygsId, intygsTyp);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.CONCURRENT_MODIFICATION, e.getMessage());
}
request.getSession(true).removeAttribute(LAST_SAVED_DRAFT);
return new SignaturTicketResponse(ticket);
}
use of se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse in project webcert by sklintyg.
the class UtkastModuleApiController method serverSigneraUtkast.
/**
* Signera utkast. Endast fejkinloggning.
*
* @param intygsId intyg id
* @return SignaturTicketResponse
*/
@POST
@Path("/{intygsTyp}/{intygsId}/{version}/signeraserver")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public SignaturTicketResponse serverSigneraUtkast(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId, @PathParam("version") long version, @Context HttpServletRequest request) {
verifyIsAuthorizedToSignIntyg(intygsTyp);
SignaturTicket ticket;
try {
ticket = signaturService.serverSignature(intygsId, version);
} catch (OptimisticLockException | OptimisticLockingFailureException e) {
monitoringLogService.logUtkastConcurrentlyEdited(intygsId, intygsTyp);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.CONCURRENT_MODIFICATION, e.getMessage());
}
request.getSession(true).removeAttribute(LAST_SAVED_DRAFT);
return new SignaturTicketResponse(ticket);
}
Aggregations