tolbertam commented on code in PR #3109:
URL: https://github.com/apache/cassandra/pull/3109#discussion_r1491829621


##########
src/java/org/apache/cassandra/auth/SpiffeCertificateValidator.java:
##########
@@ -31,27 +32,45 @@
  * This class assumes that the identity of a certificate is SPIFFE which is a 
URI that is present as part of the SAN
  * of the client certificate. It has logic to extract identity (Spiffe) out of 
a certificate & knows how to validate
  * the client certificates.
- * <p>
  *
- * <p>
- * Example:
+ * <p>Example:
+ * <pre>
  * internode_authenticator:
- * class_name : org.apache.cassandra.auth.MutualTlsAuthenticator
- * parameters :
- * validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator
+ *   class_name: org.apache.cassandra.auth.MutualTlsAuthenticator
+ *   parameters:
+ *     validator_class_name: 
org.apache.cassandra.auth.SpiffeCertificateValidator
+ * </pre>
+ *
+ * <pre>
  * authenticator:
- * class_name : org.apache.cassandra.auth.MutualTlsInternodeAuthenticator
- * parameters :
- * validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator
+ *   class_name: org.apache.cassandra.auth.MutualTlsInternodeAuthenticator
+ *   parameters:
+ *     validator_class_name: 
org.apache.cassandra.auth.SpiffeCertificateValidator
+ * </pre>
  */
 public class SpiffeCertificateValidator implements 
MutualTlsCertificateValidator
 {
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public boolean isValidCertificate(Certificate[] clientCertificateChain)
+    public boolean isValidCertificate(Certificate[] clientCertificateChain, 
int maxCertificateAgeMinutes) throws AuthenticationException
     {
+        X509Certificate[] castedCerts = 
castCertsToX509(clientCertificateChain);
+        int certificateAgeInMinutes = 
getCertificateAgeInMinutes(castedCerts[0]);
+        if (certificateAgeInMinutes > maxCertificateAgeMinutes)
+        {
+            String errorMessage = String.format("The age of the provided 
certificate exceeds the maximum allowed age of %d minutes",

Review Comment:
   Looking at `DurationSpec` code, it looks like this isn't easily achievable, 
and I think there is precedence in C* for logging in the resolved unit rather 
than the given one, so probably ok to remain this way.



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