Search in sources :

Example 6 with SignaturTicketResponse

use of se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse 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);
}
Also used : OptimisticLockingFailureException(org.springframework.dao.OptimisticLockingFailureException) OptimisticLockException(javax.persistence.OptimisticLockException) SignaturTicket(se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket) WebCertServiceException(se.inera.intyg.webcert.common.service.exception.WebCertServiceException) SignaturTicketResponse(se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Aggregations

Path (javax.ws.rs.Path)6 Produces (javax.ws.rs.Produces)6 SignaturTicket (se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket)6 SignaturTicketResponse (se.inera.intyg.webcert.web.web.controller.moduleapi.dto.SignaturTicketResponse)6 OptimisticLockException (javax.persistence.OptimisticLockException)5 POST (javax.ws.rs.POST)5 OptimisticLockingFailureException (org.springframework.dao.OptimisticLockingFailureException)5 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)5 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1