sarankk commented on code in PR #137:
URL: https://github.com/apache/cassandra-sidecar/pull/137#discussion_r1796215784


##########
vertx-auth-mtls/src/main/java/io/vertx/ext/auth/mtls/CertificateValidator.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.vertx.ext.auth.mtls;
+
+import io.vertx.ext.auth.authentication.CertificateCredentials;
+
+import java.security.cert.CertificateParsingException;
+
+/**
+ * Interface for validating certificates for mutual TLS authentication.
+ * <p>
+ * This interface can be implemented to provide logic for validating various 
fields from Certificates.
+ */
+public interface CertificateValidator

Review Comment:
   `CertificateValidator` and `CertificateIdentityValidator` are independent 
validators. Former validates details in certificates (such as issuer, owner, 
validity) and latter validates the identity extracted from certificate is 
trusted identity. We could have `AllowAllCertificateValidator` with custom 
`SpiffeIdentityValidator`, in scenario where users are not particular about 
certificate details, but only care about identity within a certificate. 
Likewise we could have custom `CertificateValidator` and 
`AllowAllIdentityValidator` if user cares about only details within the 
certificate. 
   
   We can combine `CertificateIdentityExtractor` and 
`CertificateIdentityValidator` interfaces. Reason I had the identity extractor 
separately is, we can use the identity extracted for authorization. But we 
could combine both the interfaces under `CertificateIdentityExtractor` and have 
the valid method return the identity. for e.g.
   
   `String validIdentity(Certificate certificate) throws 
IdentityValidationException` 
   
   wdyt?
   



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to