exceptionfactory commented on code in PR #7580:
URL: https://github.com/apache/nifi/pull/7580#discussion_r1286559865
##########
nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-common/pom.xml:
##########
@@ -44,6 +44,11 @@
<artifactId>nifi-security-utils-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-security-utils</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
Review Comment:
Unfortunately the `nifi-security-utils` library has a larger set of
transitive dependencies than it should right now. This is a longer-term goal,
but for the moment, I recommend avoiding it as a runtime dependency.
##########
nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-common/src/main/java/org/apache/nifi/processors/grpc/FlowFileIngestServiceInterceptor.java:
##########
@@ -100,10 +104,11 @@ public <I, O> ServerCall.Listener<I> interceptCall(
final SSLSession sslSession =
attributes.get(Grpc.TRANSPORT_ATTR_SSL_SESSION);
if (this.authorizedDNPattern != null && sslSession != null) {
try {
- final X509Certificate[] certs =
sslSession.getPeerCertificateChain();
+ final Certificate[] certs = sslSession.getPeerCertificates();
if (certs != null && certs.length > 0) {
- for (final X509Certificate cert : certs) {
- foundSubject = cert.getSubjectDN().getName();
+ for (final Certificate cert : certs) {
+ final X509Certificate x509Cert =
CertificateUtils.convertAbstractX509Certificate(cert);
Review Comment:
This convert method can be replaced with a simple cast, avoiding the
dependency on `nifi-security-utils`.
```suggestion
final X509Certificate x509Cert = (X509Certificate)
cert;
```
A private method could be introduced to run an `instanceof` check on the
`Certificate` object, but the end result would still be some subclass of a
`RuntimeException`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]