This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

The following commit(s) were added to refs/heads/8.5.x by this push:
     new 1beddae  replace deprecated getSubjectDN()
1beddae is described below

commit 1beddae0d80a643d50034aaa9b423a233406b772
Author: sim-lus <67785631+sim-...@users.noreply.github.com>
AuthorDate: Wed Mar 16 12:45:36 2022 +0100

    replace deprecated getSubjectDN()
    
    According to java spec, getSubjectDN() should not be used:
    "denigrated, replaced by getSubjectX500Principal(). This method returns the 
subject as an implementation specific Principal object, which should not be 
relied upon by portable code."
    
    Not sure if my proposed change is correct, at least it is probably not 
compatible for all use cases.
---
 java/org/apache/catalina/realm/X509SubjectDnRetriever.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/realm/X509SubjectDnRetriever.java 
b/java/org/apache/catalina/realm/X509SubjectDnRetriever.java
index 7aa5a3a..1602c91 100644
--- a/java/org/apache/catalina/realm/X509SubjectDnRetriever.java
+++ b/java/org/apache/catalina/realm/X509SubjectDnRetriever.java
@@ -26,6 +26,6 @@ public class X509SubjectDnRetriever implements 
X509UsernameRetriever {
 
     @Override
     public String getUsername(X509Certificate clientCert) {
-        return clientCert.getSubjectDN().getName();
+        return clientCert.getSubjectX500Principal().getName();
     }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to