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 b04c1df  Align with 10.0.x: Add SSO cookieName configuration attribute
b04c1df is described below

commit b04c1df7f41926af0aa7cb93060166a9802008be
Author: remm <r...@apache.org>
AuthorDate: Wed Apr 1 14:46:04 2020 +0200

    Align with 10.0.x: Add SSO cookieName configuration attribute
---
 .../catalina/authenticator/AuthenticatorBase.java  |  2 +-
 .../apache/catalina/authenticator/Constants.java   |  1 +
 .../catalina/authenticator/SingleSignOn.java       | 23 +++++++++++++++++++++-
 webapps/docs/changelog.xml                         |  4 ++++
 webapps/docs/config/valve.xml                      |  5 +++++
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index b20b4b6..79b1bc5 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -1214,7 +1214,7 @@ public abstract class AuthenticatorBase extends ValveBase
         if (ssoId == null) {
             // Construct a cookie to be returned to the client
             ssoId = sessionIdGenerator.generateSessionId();
-            Cookie cookie = new Cookie(Constants.SINGLE_SIGN_ON_COOKIE, ssoId);
+            Cookie cookie = new Cookie(sso.getCookieName(), ssoId);
             cookie.setMaxAge(-1);
             cookie.setPath("/");
 
diff --git a/java/org/apache/catalina/authenticator/Constants.java 
b/java/org/apache/catalina/authenticator/Constants.java
index 66f2a49..5a316ef 100644
--- a/java/org/apache/catalina/authenticator/Constants.java
+++ b/java/org/apache/catalina/authenticator/Constants.java
@@ -17,6 +17,7 @@
 package org.apache.catalina.authenticator;
 
 public class Constants {
+
     // Authentication methods for login configuration
     // Servlet spec schemes are defined in HttpServletRequest
     // Vendor specific schemes
diff --git a/java/org/apache/catalina/authenticator/SingleSignOn.java 
b/java/org/apache/catalina/authenticator/SingleSignOn.java
index 31fdb1f..9ce30fe 100644
--- a/java/org/apache/catalina/authenticator/SingleSignOn.java
+++ b/java/org/apache/catalina/authenticator/SingleSignOn.java
@@ -94,6 +94,10 @@ public class SingleSignOn extends ValveBase {
      */
     private String cookieDomain;
 
+    /**
+     * SSO cookie name, the default value is <code>JSESSIONIDSSO</code>.
+     */
+    private String cookieName = Constants.SINGLE_SIGN_ON_COOKIE;
 
     // ------------------------------------------------------------- Properties
 
@@ -123,6 +127,23 @@ public class SingleSignOn extends ValveBase {
 
 
     /**
+     * @return the cookie name
+     */
+    public String getCookieName() {
+        return cookieName;
+    }
+
+
+    /**
+     * Set the cookie name that will be used for the SSO cookie.
+     * @param cookieName the cookieName to set
+     */
+    public void setCookieName(String cookieName) {
+        this.cookieName = cookieName;
+    }
+
+
+    /**
      * Gets whether each request needs to be reauthenticated (by an
      * Authenticator downstream in the pipeline) to the security
      * <code>Realm</code>, or if this Valve can itself bind security info
@@ -227,7 +248,7 @@ public class SingleSignOn extends ValveBase {
         Cookie cookies[] = request.getCookies();
         if (cookies != null) {
             for (Cookie value : cookies) {
-                if (Constants.SINGLE_SIGN_ON_COOKIE.equals(value.getName())) {
+                if (cookieName.equals(value.getName())) {
                     cookie = value;
                     break;
                 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8863b76..8f8304c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
         encoding of the file. Based on a pull request by Jean-Louis Monteiro.
         (markt)
       </add>
+      <update>
+        Add <code>cookieName</code> attribute to the SSO valve to configure the
+        SSO cookie name. (remm)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 9b176f6..04760d9 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -1295,6 +1295,11 @@
         <p>Sets the host domain to be used for sso cookies.</p>
       </attribute>
 
+      <attribute name="cookieName" required="false">
+        <p>Sets the cookie name to be used for sso cookies. The default value
+        is <code>JSESSIONIDSSO</code></p>
+      </attribute>
+
     </attributes>
 
   </subsection>

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

Reply via email to