Conversation
ed385dd to
2c1de73
Compare
| * @throws AuthTokenException when user certificate is revoked or revocation check fails. | ||
| */ | ||
| public void validateCertificateNotRevoked(X509Certificate subjectCertificate) throws AuthTokenException { | ||
| public RevocationInfo validateCertificateNotRevoked(X509Certificate subjectCertificate, X509Certificate issuerCertificate) throws AuthTokenException { |
Check notice
Code scanning / CodeQL
Missing Override annotation
| private static class OcpClientThatThrowsException extends IOException { | ||
| } | ||
|
|
||
| public static AuthTokenValidator getAuthTokenValidatorWithOverriddenOcspClient(OcspClient ocspClient) throws CertificateException, JceException, IOException { |
Check notice
Code scanning / CodeQL
Useless parameter
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
The best way to fix this problem is to remove the unused parameter from the method signature and update all method calls to stop passing the unnecessary argument. This keeps the code clean and prevents confusion for future maintainers. Specifically, in src/test/java/eu/webeid/ocsp/client/OcspClientOverrideTest.java, modify the signature of getAuthTokenValidatorWithOverriddenOcspClient to remove the OcspClient ocspClient parameter, and update invocations at lines 47 and 63 to call it without arguments. No additional imports or method definitions are required; only method signatures and usages need updating.
| @@ -44,7 +44,7 @@ | ||
|
|
||
| @Test | ||
| void whenOcspClientIsOverridden_thenItIsUsed() throws JceException, CertificateException, IOException { | ||
| final AuthTokenValidator validator = getAuthTokenValidatorWithOverriddenOcspClient(new OcpClientThatThrows()); | ||
| final AuthTokenValidator validator = getAuthTokenValidatorWithOverriddenOcspClient(); | ||
| assertThatThrownBy(() -> validator.validate(validAuthToken, VALID_CHALLENGE_NONCE)) | ||
| .cause() | ||
| .isInstanceOf(OcpClientThatThrowsException.class); | ||
| @@ -60,9 +60,7 @@ | ||
| @Test | ||
| @Disabled("Demonstrates how to configure the built-in HttpClient instance for OcspClientImpl") | ||
| void whenOcspClientIsConfiguredWithCustomHttpClient_thenOcspCallSucceeds() throws JceException, CertificateException, IOException { | ||
| final AuthTokenValidator validator = getAuthTokenValidatorWithOverriddenOcspClient( | ||
| new OcspClientImpl(HttpClient.newBuilder().build(), Duration.ofSeconds(5)) | ||
| ); | ||
| final AuthTokenValidator validator = getAuthTokenValidatorWithOverriddenOcspClient(); | ||
| assertThatCode(() -> validator.validate(validAuthToken, VALID_CHALLENGE_NONCE)) | ||
| .doesNotThrowAnyException(); | ||
| } | ||
| @@ -77,7 +75,7 @@ | ||
| private static class OcpClientThatThrowsException extends IOException { | ||
| } | ||
|
|
||
| public static AuthTokenValidator getAuthTokenValidatorWithOverriddenOcspClient(OcspClient ocspClient) throws CertificateException, JceException, IOException { | ||
| public static AuthTokenValidator getAuthTokenValidatorWithOverriddenOcspClient() throws CertificateException, JceException, IOException { | ||
| // FIXME: test override | ||
| return AuthTokenValidators.getAuthTokenValidator(); | ||
| } |
9f7fb95 to
2e783f3
Compare
20426da to
7e98567
Compare
daf2a6c to
d6eebea
Compare
b7b0220 to
10e86be
Compare
…tation to eu.webeid.ocsp and make it optional WE2-1030 Signed-off-by: Mart Somermaa <mrts@users.noreply.github.com>
10e86be to
310224e
Compare
|
| * depending on {@code revocationMode}. | ||
| * <p> | ||
| * Trust validation is performed by building a certification path from {@code certificate} to one of the | ||
| * configured {@code trustedCACertificateAnchors} using the supplied {@code trustedCACertificateCertStore}. |
There was a problem hiding this comment.
Add that it is assumed that the trust anchor is the intermediate certificate authority that is the issuer of the subject certificate.



WE2-1030
Signed-off-by: Mart Somermaa mrts@users.noreply.github.com