use of se.funktionstjanster.grp.v1.OrderResponseType in project webcert by sklintyg.
the class GrpSignaturServiceImpl method startGrpAuthentication.
@Override
public SignaturTicket startGrpAuthentication(String intygId, long version) {
Utkast utkast = utkastRepository.findOne(intygId);
validateUtkast(intygId, utkast);
WebCertUser webCertUser = webCertUserService.getUser();
validateWebCertUser(webCertUser);
String personId = webCertUser.getPersonId();
validatePersonId(personId);
SignaturTicket draftHash = signaturService.createDraftHash(intygId, utkast.getVersion());
AuthenticateRequestType authRequest = buildAuthRequest(personId, draftHash);
OrderResponseType orderResponse;
try {
orderResponse = grpService.authenticate(authRequest);
} catch (GrpFault grpFault) {
signaturTicketTracker.updateStatus(draftHash.getId(), SignaturTicket.Status.OKAND);
Optional<FaultStatusType> status = Optional.ofNullable(grpFault.getFaultInfo()).map(GrpFaultType::getFaultStatus);
if (status.isPresent()) {
LOG.warn("Fault signing utkast with id {} with GRP. FaultStatus: {}", intygId, status.get().name());
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.GRP_PROBLEM, status.get().name());
} else {
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.UNKNOWN_INTERNAL_PROBLEM, grpFault.getMessage());
}
}
// If we could init the authentication, we create a SignaturTicket, reusing
// the mechanism already present for SITHS
String orderRef = orderResponse.getOrderRef();
String transactionId = validateOrderResponseTxId(authRequest, orderResponse);
startAsyncCollectPoller(orderRef, transactionId);
return draftHash;
}
use of se.funktionstjanster.grp.v1.OrderResponseType in project webcert by sklintyg.
the class GrpSignaturServiceTest method buildOrderResponse.
private OrderResponseType buildOrderResponse() {
OrderResponseType resp = new OrderResponseType();
resp.setTransactionId(TX_ID);
resp.setOrderRef(ORDER_REF);
return resp;
}
Aggregations