@Test(expected = WebCertServiceException.class) public void testStartSignUtkastAlreadySigned() { when(utkastRepository.findById(INTYG_ID)) .thenReturn(Optional.of(createUtkast(INTYG_ID, 1L, INTYG_TYP, UtkastStatus.SIGNED, "model", vardperson, ENHET_ID, PERSON_ID))); testee.startSigningProcess(INTYG_ID, INTYG_TYP, 1L, SignMethod.FAKE, TICKET_ID); }
@Override public SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod, String ticketId) { WebCertUser user = webCertUserService.getUser(); Utkast utkast = getUtkastForSignering(intygsId, version, user); String updatedJson = updateJsonWithVardpersonAndSigneringsTid(utkast, user); SignaturBiljett signaturBiljett = null; switch (user.getAuthenticationMethod()) { case SITHS: case NET_ID: case FAKE: signaturBiljett = xmlUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; case BANK_ID: case MOBILT_BANK_ID: signaturBiljett = grpUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; } if (signaturBiljett == null) { throw new IllegalStateException("Unhandled authentication method, could not create SignaturBiljett"); } if (signaturBiljett.getSignMethod() == SignMethod.GRP) { grpUnderskriftService.startGrpCollectPoller(user.getPersonId(), signaturBiljett); } return signaturBiljett; }
UnderskriftServiceImpl implements UnderskriftService { @Override public SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod, String ticketId) { WebCertUser user = webCertUserService.getUser(); Utkast utkast = getUtkastForSignering(intygsId, version, user); String updatedJson = updateJsonWithVardpersonAndSigneringsTid(utkast, user); SignaturBiljett signaturBiljett = null; switch (user.getAuthenticationMethod()) { case SITHS: case NET_ID: case FAKE: signaturBiljett = xmlUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; case BANK_ID: case MOBILT_BANK_ID: signaturBiljett = grpUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; } if (signaturBiljett == null) { throw new IllegalStateException("Unhandled authentication method, could not create SignaturBiljett"); } if (signaturBiljett.getSignMethod() == SignMethod.GRP) { grpUnderskriftService.startGrpCollectPoller(user.getPersonId(), signaturBiljett); } return signaturBiljett; } }
UnderskriftServiceImpl implements UnderskriftService { @Override public SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod, String ticketId) { WebCertUser user = webCertUserService.getUser(); Utkast utkast = getUtkastForSignering(intygsId, version, user); String updatedJson = updateJsonWithVardpersonAndSigneringsTid(utkast, user); SignaturBiljett signaturBiljett = null; switch (user.getAuthenticationMethod()) { case SITHS: case NET_ID: case FAKE: signaturBiljett = xmlUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; case BANK_ID: case MOBILT_BANK_ID: signaturBiljett = grpUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; } if (signaturBiljett == null) { throw new IllegalStateException("Unhandled authentication method, could not create SignaturBiljett"); } if (signaturBiljett.getSignMethod() == SignMethod.GRP) { grpUnderskriftService.startGrpCollectPoller(user.getPersonId(), signaturBiljett); } return signaturBiljett; }  }
UnderskriftServiceImpl implements UnderskriftService { @Override public SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod, String ticketId) { WebCertUser user = webCertUserService.getUser(); Utkast utkast = getUtkastForSignering(intygsId, version, user); String updatedJson = updateJsonWithVardpersonAndSigneringsTid(utkast, user); SignaturBiljett signaturBiljett = null; switch (user.getAuthenticationMethod()) { case SITHS: case NET_ID: case FAKE: signaturBiljett = xmlUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; case BANK_ID: case MOBILT_BANK_ID: signaturBiljett = grpUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; } if (signaturBiljett == null) { throw new IllegalStateException("Unhandled authentication method, could not create SignaturBiljett"); } if (signaturBiljett.getSignMethod() == SignMethod.GRP) { grpUnderskriftService.startGrpCollectPoller(user.getPersonId(), signaturBiljett); } return signaturBiljett; }  @Override SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod,
        String ticketId); @Override SignaturBiljett fakeSignature(String intygsId, String intygsTyp, long version, String ticketId); @Override SignaturBiljett netidSignature(String biljettId, byte[] signatur, String certifikat); @Override SignaturBiljett grpSignature(String biljettId, byte[] signatur); @Override SignaturBiljett signeringsStatus(String ticketId); }
UnderskriftServiceImpl implements UnderskriftService { @Override public SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod, String ticketId) { WebCertUser user = webCertUserService.getUser(); Utkast utkast = getUtkastForSignering(intygsId, version, user); String updatedJson = updateJsonWithVardpersonAndSigneringsTid(utkast, user); SignaturBiljett signaturBiljett = null; switch (user.getAuthenticationMethod()) { case SITHS: case NET_ID: case FAKE: signaturBiljett = xmlUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; case BANK_ID: case MOBILT_BANK_ID: signaturBiljett = grpUnderskriftService .skapaSigneringsBiljettMedDigest(intygsId, intygsTyp, version, updatedJson, signMethod, ticketId); break; } if (signaturBiljett == null) { throw new IllegalStateException("Unhandled authentication method, could not create SignaturBiljett"); } if (signaturBiljett.getSignMethod() == SignMethod.GRP) { grpUnderskriftService.startGrpCollectPoller(user.getPersonId(), signaturBiljett); } return signaturBiljett; }  @Override SignaturBiljett startSigningProcess(String intygsId, String intygsTyp, long version, SignMethod signMethod,
        String ticketId); @Override SignaturBiljett fakeSignature(String intygsId, String intygsTyp, long version, String ticketId); @Override SignaturBiljett netidSignature(String biljettId, byte[] signatur, String certifikat); @Override SignaturBiljett grpSignature(String biljettId, byte[] signatur); @Override SignaturBiljett signeringsStatus(String ticketId);  }