use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class SignaturTicketTrackerTest method prune.
@Test
public void prune() {
for (int i = 1; i < 100; i++) {
tracker.trackTicket(new SignaturTicket("old-" + i, PAGAENDE_SIG_ID, BEARBETAR, "intygid", 1, LocalDateTime.now(), "1234", LocalDateTime.now().minusMinutes(6)));
tracker.trackTicket(new SignaturTicket(String.valueOf(i), PAGAENDE_SIG_ID, BEARBETAR, "intygid", 1, LocalDateTime.now(), "1234", LocalDateTime.now()));
}
SignaturTicket tracked = tracker.getTicket("1");
assertEquals(BEARBETAR, tracked.getStatus());
assertNull(tracker.getTicket("old-1"));
}
use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket 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.service.signatur.dto.SignaturTicket 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.service.signatur.dto.SignaturTicket 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);
}
use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class UtkastModuleApiController method serverSigneraUtkastMedNias.
/**
* Signera utkast mha NetiD Access Server (nias).
*
* @param intygsId intyg id
* @return SignaturTicketResponse
*/
@POST
@Path("/{intygsTyp}/{intygsId}/{version}/nias/signeraserver")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public SignaturTicketResponse serverSigneraUtkastMedNias(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId, @PathParam("version") long version, @Context HttpServletRequest request) {
verifyIsAuthorizedToSignIntyg(intygsTyp);
SignaturTicket ticket;
try {
ticket = niasSignaturService.startNiasAuthentication(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