@@ -117,7 +117,29 @@ public List<RevocationInfo> validateCertificateNotRevoked(X509Certificate subjec
117117 circuitBreaker .getEventPublisher ().onError (event -> createAndAddRevocationInfoToList (event .getThrowable (), revocationInfoList ));
118118
119119 CheckedFunction0 <RevocationInfo > primarySupplier = () -> request (ocspService , subjectCertificate , issuerCertificate , false );
120- CheckedFunction0 <RevocationInfo > fallbackSupplier = () -> request (ocspService .getFallbackService (), subjectCertificate , issuerCertificate , true );
120+ OcspService firstFallbackService = ocspService .getFallbackService ();
121+ CheckedFunction0 <RevocationInfo > firstFallbackSupplier = () -> request (firstFallbackService , subjectCertificate , issuerCertificate , true );
122+ OcspService secondFallbackService = getOcspServiceProvider ().getFallbackService (firstFallbackService .getAccessLocation ());
123+ CheckedFunction0 <RevocationInfo > fallbackSupplier ;
124+ if (secondFallbackService == null ) {
125+ fallbackSupplier = firstFallbackSupplier ;
126+ } else {
127+ CheckedFunction0 <RevocationInfo > secondFallbackSupplier = () -> request (secondFallbackService , subjectCertificate , issuerCertificate , true );
128+ fallbackSupplier = () -> {
129+ try {
130+ return firstFallbackSupplier .apply ();
131+ } catch (Exception e ) {
132+ if (e instanceof ResilientUserCertificateOCSPCheckFailedException exception ) {
133+ revocationInfoList .addAll ((exception .getValidationInfo ().revocationInfoList ()));
134+ } else {
135+ revocationInfoList .add (new RevocationInfo (null , Map .ofEntries (
136+ Map .entry (RevocationInfo .KEY_OCSP_ERROR , e )
137+ )));
138+ }
139+ return secondFallbackSupplier .apply ();
140+ }
141+ };
142+ }
121143 Decorators .DecorateCheckedSupplier <RevocationInfo > decorateCheckedSupplier = Decorators .ofCheckedSupplier (primarySupplier );
122144 if (retryRegistry != null ) {
123145 Retry retry = retryRegistry .retry (ocspService .getAccessLocation ().toASCIIString ());
0 commit comments