Search in sources :

Example 1 with ServiceSupplyPointsType

use of eu.europa.esig.trustedlist.jaxb.tsl.ServiceSupplyPointsType in project ref-GemLibPki by gematik.

the class TucPki018VerifierTest method overwriteSspUrls.

@SneakyThrows
private static void overwriteSspUrls(final List<TspService> tspServiceList) {
    final ServiceSupplyPointsType serviceSupplyPointsType = new ServiceSupplyPointsType();
    final AttributedNonEmptyURIType newSspUrl = new AttributedNonEmptyURIType();
    newSspUrl.setValue(ocspResponderMock.getSspUrl());
    serviceSupplyPointsType.getServiceSupplyPoint().add(newSspUrl);
    tspServiceList.forEach(tspService -> tspService.getTspServiceType().getServiceInformation().setServiceSupplyPoints(serviceSupplyPointsType));
}
Also used : AttributedNonEmptyURIType(eu.europa.esig.trustedlist.jaxb.tsl.AttributedNonEmptyURIType) ServiceSupplyPointsType(eu.europa.esig.trustedlist.jaxb.tsl.ServiceSupplyPointsType) SneakyThrows(lombok.SneakyThrows)

Example 2 with ServiceSupplyPointsType

use of eu.europa.esig.trustedlist.jaxb.tsl.ServiceSupplyPointsType in project ref-GemLibPki by gematik.

the class TspInformationProvider method getFirstServiceSupplyPointFromTspService.

/**
 * Get OCSP responder URL from given TspService.
 *
 * @param tspService the given TspService
 * @return ServiceSupplyPoint as string (URL)
 * @throws GemPkiException exception thrown if service supply point is missing
 */
private String getFirstServiceSupplyPointFromTspService(final TspService tspService) throws GemPkiException {
    final Optional<ServiceSupplyPointsType> serviceSupplyPointsType = Optional.ofNullable(tspService.getTspServiceType().getServiceInformation().getServiceSupplyPoints());
    if (serviceSupplyPointsType.isEmpty()) {
        throw new GemPkiException(productType, ErrorCode.TE_1026);
    }
    final String firstServiceSupplyPoint = serviceSupplyPointsType.get().getServiceSupplyPoint().get(0).getValue();
    if (firstServiceSupplyPoint.isBlank()) {
        throw new GemPkiException(productType, ErrorCode.TE_1026);
    } else {
        log.debug("Der erste ServiceSupplyPoint wurde ermittelt {}", firstServiceSupplyPoint);
        return firstServiceSupplyPoint;
    }
}
Also used : GemPkiException(de.gematik.pki.exception.GemPkiException) ASN1OctetString(org.bouncycastle.asn1.ASN1OctetString) ServiceSupplyPointsType(eu.europa.esig.trustedlist.jaxb.tsl.ServiceSupplyPointsType)

Aggregations

ServiceSupplyPointsType (eu.europa.esig.trustedlist.jaxb.tsl.ServiceSupplyPointsType)2 GemPkiException (de.gematik.pki.exception.GemPkiException)1 AttributedNonEmptyURIType (eu.europa.esig.trustedlist.jaxb.tsl.AttributedNonEmptyURIType)1 SneakyThrows (lombok.SneakyThrows)1 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)1