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

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

commit c544039a9caca2a6a13f2ca0c7787ce36df3ab95
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Sep 9 08:50:37 2022 +0100

    Rename / refactor in preparation for fixing BZ 62312
---
 java/org/apache/tomcat/websocket/Authenticator.java   | 19 +++++++++++++++++++
 .../apache/tomcat/websocket/BasicAuthenticator.java   |  2 +-
 .../apache/tomcat/websocket/DigestAuthenticator.java  |  2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/Authenticator.java 
b/java/org/apache/tomcat/websocket/Authenticator.java
index aacbdb47f0..4ff78281d1 100644
--- a/java/org/apache/tomcat/websocket/Authenticator.java
+++ b/java/org/apache/tomcat/websocket/Authenticator.java
@@ -28,6 +28,7 @@ public abstract class Authenticator {
 
     private static final Pattern pattern = 
Pattern.compile("(\\w+)\\s*=\\s*(\"([^\"]+)\"|([^,=\"]+))\\s*,?");
 
+
     /**
      * Generate the authorization header value that will be sent to the server.
      *
@@ -42,6 +43,7 @@ public abstract class Authenticator {
     public abstract String getAuthorization(String requestUri, String 
authenticateHeader,
             Map<String, Object> userProperties) throws AuthenticationException;
 
+
     /**
      * Get the authentication method.
      *
@@ -49,14 +51,31 @@ public abstract class Authenticator {
      */
     public abstract String getSchemeName();
 
+
     /**
      * Utility method to parse the authentication header.
      *
      * @param authenticateHeader The server authenticate header received
      *
      * @return a map of authentication parameter names and values
+     *
+     * @deprecated Use {@link Authenticator#parseAuthenticateHeader(String)}.
+     *             Will be removed in Tomcat 10.1.x onwards
      */
+    @Deprecated
     public Map<String, String> parseWWWAuthenticateHeader(String 
authenticateHeader) {
+        return parseAuthenticateHeader(authenticateHeader);
+    }
+
+
+    /**
+     * Utility method to parse the authentication header.
+     *
+     * @param authenticateHeader The server authenticate header received
+     *
+     * @return a map of authentication parameter names and values
+     */
+    public Map<String, String> parseAuthenticateHeader(String 
authenticateHeader) {
 
         Matcher m = pattern.matcher(authenticateHeader);
         Map<String, String> parameterMap = new HashMap<>();
diff --git a/java/org/apache/tomcat/websocket/BasicAuthenticator.java 
b/java/org/apache/tomcat/websocket/BasicAuthenticator.java
index 02f34ebee2..68dcccdd5f 100644
--- a/java/org/apache/tomcat/websocket/BasicAuthenticator.java
+++ b/java/org/apache/tomcat/websocket/BasicAuthenticator.java
@@ -41,7 +41,7 @@ public class BasicAuthenticator extends Authenticator {
                     "Failed to perform Basic authentication due to  missing 
user/password");
         }
 
-        Map<String, String> parameterMap = 
parseWWWAuthenticateHeader(authenticateHeader);
+        Map<String, String> parameterMap = 
parseAuthenticateHeader(authenticateHeader);
 
         String userPass = userName + ":" + userPassword;
         Charset charset;
diff --git a/java/org/apache/tomcat/websocket/DigestAuthenticator.java 
b/java/org/apache/tomcat/websocket/DigestAuthenticator.java
index 53c3f45a28..fef0106013 100644
--- a/java/org/apache/tomcat/websocket/DigestAuthenticator.java
+++ b/java/org/apache/tomcat/websocket/DigestAuthenticator.java
@@ -47,7 +47,7 @@ public class DigestAuthenticator extends Authenticator {
                     "Failed to perform Digest authentication due to  missing 
user/password");
         }
 
-        Map<String, String> parameterMap = 
parseWWWAuthenticateHeader(authenticateHeader);
+        Map<String, String> parameterMap = 
parseAuthenticateHeader(authenticateHeader);
 
         String realm = parameterMap.get("realm");
         String nonce = parameterMap.get("nonce");


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

Reply via email to