You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/05/23 10:39:15 UTC

[tomcat] branch 8.5.x updated (46d81a2019 -> cc8eb4e1ef)

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

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


    from 46d81a2019 Additional false positives
     new 55c8468456 Code clean-up. Formatting. No functional change.
     new cc8eb4e1ef Align with 9.0.x and 10.1.x

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/authenticator/AuthenticatorBase.java  |  12 +--
 .../apache/catalina/authenticator/Constants.java   |   5 +-
 .../authenticator/DigestAuthenticator.java         |  36 +++----
 .../catalina/authenticator/SavedRequest.java       |   2 +-
 .../catalina/authenticator/SingleSignOn.java       |   2 +-
 .../catalina/authenticator/SingleSignOnEntry.java  |   6 +-
 .../authenticator/SpnegoAuthenticator.java         |   2 +-
 .../jaspic/AuthConfigFactoryImpl.java              | 104 +++++++++------------
 .../authenticator/jaspic/CallbackHandlerImpl.java  |  11 +--
 .../authenticator/jaspic/MessageInfoImpl.java      |  10 +-
 .../jaspic/PersistentProviderRegistrations.java    |  30 +++---
 .../jaspic/SimpleAuthConfigProvider.java           |  18 ++--
 .../jaspic/SimpleServerAuthConfig.java             |  19 ++--
 .../jaspic/SimpleServerAuthContext.java            |  14 ++-
 14 files changed, 122 insertions(+), 149 deletions(-)


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


[tomcat] 02/02: Align with 9.0.x and 10.1.x

Posted by ma...@apache.org.
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

commit cc8eb4e1ef4846e6d970f493aa196b87df8d1290
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 23 11:39:03 2023 +0100

    Align with 9.0.x and 10.1.x
---
 java/org/apache/catalina/authenticator/Constants.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/org/apache/catalina/authenticator/Constants.java b/java/org/apache/catalina/authenticator/Constants.java
index 0fa2af7cc1..f6d836915b 100644
--- a/java/org/apache/catalina/authenticator/Constants.java
+++ b/java/org/apache/catalina/authenticator/Constants.java
@@ -17,7 +17,6 @@
 package org.apache.catalina.authenticator;
 
 public class Constants {
-
     // Authentication methods for login configuration
     // Servlet spec schemes are defined in HttpServletRequest
     // Vendor specific schemes


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


[tomcat] 01/02: Code clean-up. Formatting. No functional change.

Posted by ma...@apache.org.
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

commit 55c8468456ff228dab91cb021365826acdc57373
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 23 11:23:54 2023 +0100

    Code clean-up. Formatting. No functional change.
---
 .../catalina/authenticator/AuthenticatorBase.java  |  12 +--
 .../apache/catalina/authenticator/Constants.java   |   4 +-
 .../authenticator/DigestAuthenticator.java         |  36 +++----
 .../catalina/authenticator/SavedRequest.java       |   2 +-
 .../catalina/authenticator/SingleSignOn.java       |   2 +-
 .../catalina/authenticator/SingleSignOnEntry.java  |   6 +-
 .../authenticator/SpnegoAuthenticator.java         |   2 +-
 .../jaspic/AuthConfigFactoryImpl.java              | 104 +++++++++------------
 .../authenticator/jaspic/CallbackHandlerImpl.java  |  11 +--
 .../authenticator/jaspic/MessageInfoImpl.java      |  10 +-
 .../jaspic/PersistentProviderRegistrations.java    |  30 +++---
 .../jaspic/SimpleAuthConfigProvider.java           |  18 ++--
 .../jaspic/SimpleServerAuthConfig.java             |  19 ++--
 .../jaspic/SimpleServerAuthContext.java            |  14 ++-
 14 files changed, 122 insertions(+), 148 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index e25174750f..af045ae94d 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -613,8 +613,8 @@ public abstract class AuthenticatorBase extends ValveBase implements Authenticat
                 String originHeader = request.getHeader(CorsFilter.REQUEST_HEADER_ORIGIN);
                 if (originHeader != null && !originHeader.isEmpty() && RequestUtil.isValidOrigin(originHeader) &&
                         !RequestUtil.isSameOrigin(request, originHeader)) {
-                    String accessControlRequestMethodHeader = request
-                            .getHeader(CorsFilter.REQUEST_HEADER_ACCESS_CONTROL_REQUEST_METHOD);
+                    String accessControlRequestMethodHeader =
+                            request.getHeader(CorsFilter.REQUEST_HEADER_ACCESS_CONTROL_REQUEST_METHOD);
                     if (accessControlRequestMethodHeader != null && !accessControlRequestMethodHeader.isEmpty()) {
                         // This appears to be a CORS Preflight request
                         if (allowCorsPreflight == AllowCorsPreflight.ALWAYS) {
@@ -700,8 +700,8 @@ public abstract class AuthenticatorBase extends ValveBase implements Authenticat
 
         try {
             CallbackHandler callbackHandler = getCallbackHandler();
-            ServerAuthConfig serverAuthConfig = jaspicProvider.getServerAuthConfig("HttpServlet", jaspicAppContextID,
-                    callbackHandler);
+            ServerAuthConfig serverAuthConfig =
+                    jaspicProvider.getServerAuthConfig("HttpServlet", jaspicAppContextID, callbackHandler);
             String authContextID = serverAuthConfig.getAuthContextID(jaspicState.messageInfo);
             jaspicState.serverAuthContext = serverAuthConfig.getAuthContext(authContextID, null, null);
         } catch (AuthException e) {
@@ -1172,8 +1172,8 @@ public abstract class AuthenticatorBase extends ValveBase implements Authenticat
             if (client != null) {
                 ServerAuthContext serverAuthContext;
                 try {
-                    ServerAuthConfig serverAuthConfig = provider.getServerAuthConfig("HttpServlet", jaspicAppContextID,
-                            getCallbackHandler());
+                    ServerAuthConfig serverAuthConfig =
+                            provider.getServerAuthConfig("HttpServlet", jaspicAppContextID, getCallbackHandler());
                     String authContextID = serverAuthConfig.getAuthContextID(messageInfo);
                     serverAuthContext = serverAuthConfig.getAuthContext(authContextID, null, null);
                     serverAuthContext.cleanSubject(messageInfo, client);
diff --git a/java/org/apache/catalina/authenticator/Constants.java b/java/org/apache/catalina/authenticator/Constants.java
index 623bf3cecb..0fa2af7cc1 100644
--- a/java/org/apache/catalina/authenticator/Constants.java
+++ b/java/org/apache/catalina/authenticator/Constants.java
@@ -41,8 +41,8 @@ public class Constants {
     public static final String USE_SUBJECT_CREDS_ONLY_PROPERTY = "javax.security.auth.useSubjectCredsOnly";
 
     // Cookie name for single sign on support
-    public static final String SINGLE_SIGN_ON_COOKIE = System
-            .getProperty("org.apache.catalina.authenticator.Constants.SSO_SESSION_COOKIE_NAME", "JSESSIONIDSSO");
+    public static final String SINGLE_SIGN_ON_COOKIE =
+            System.getProperty("org.apache.catalina.authenticator.Constants.SSO_SESSION_COOKIE_NAME", "JSESSIONIDSSO");
 
 
     // --------------------------------------------------------- Request Notes
diff --git a/java/org/apache/catalina/authenticator/DigestAuthenticator.java b/java/org/apache/catalina/authenticator/DigestAuthenticator.java
index 0295cc21ca..311f0d53c6 100644
--- a/java/org/apache/catalina/authenticator/DigestAuthenticator.java
+++ b/java/org/apache/catalina/authenticator/DigestAuthenticator.java
@@ -69,7 +69,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
     private static final String NONCE_DIGEST = "SHA-256";
 
     // List permitted algorithms and maps them to Java standard names
-    private static final Map<String, AuthDigest> PERMITTED_ALGORITHMS = new HashMap<>();
+    private static final Map<String,AuthDigest> PERMITTED_ALGORITHMS = new HashMap<>();
     static {
         // Allows the digester to be configured with either the Standard Java name or the name used the RFC.
         for (AuthDigest authDigest : AuthDigest.values()) {
@@ -92,7 +92,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
     /**
      * List of server nonce values currently being tracked
      */
-    protected Map<String, NonceInfo> nonces;
+    protected Map<String,NonceInfo> nonces;
 
 
     /**
@@ -210,10 +210,11 @@ public class DigestAuthenticator extends AuthenticatorBase {
     public String getAlgorithms() {
         StringBuilder result = new StringBuilder();
         StringUtils.join(algorithms, ',', new Function<AuthDigest>() {
-                    @Override
-                    public String apply(AuthDigest t) { return t.getRfcName(); }
-                },
-                result);
+            @Override
+            public String apply(AuthDigest t) {
+                return t.getRfcName();
+            }
+        }, result);
         return result.toString();
     }
 
@@ -238,7 +239,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
 
 
     /*
-     *  Initialise algorithms, removing ones that the JRE does not support
+     * Initialise algorithms, removing ones that the JRE does not support
      */
     private void initAlgorithms(List<AuthDigest> algorithms) {
         Iterator<AuthDigest> algorithmIterator = algorithms.iterator();
@@ -248,7 +249,8 @@ public class DigestAuthenticator extends AuthenticatorBase {
                 ConcurrentMessageDigest.init(algorithm.getJavaName());
             } catch (NoSuchAlgorithmException e) {
                 // In theory, a JRE can choose not to implement SHA-512/256
-                log.warn(sm.getString("digestAuthenticator.unsupportedAlgorithm", algorithms, algorithm.getJavaName()), e);
+                log.warn(sm.getString("digestAuthenticator.unsupportedAlgorithm", algorithms, algorithm.getJavaName()),
+                        e);
                 algorithmIterator.remove();
             }
         }
@@ -458,7 +460,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
          * This is a FIFO cache as using an older nonce should not delay its removal from the cache in favour of more
          * recent values.
          */
-        nonces = new LinkedHashMap<String, DigestAuthenticator.NonceInfo>() {
+        nonces = new LinkedHashMap<String,DigestAuthenticator.NonceInfo>() {
 
             private static final long serialVersionUID = 1L;
             private static final long LOG_SUPPRESS_TIME = 5 * 60 * 1000;
@@ -466,7 +468,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
             private long lastLog = 0;
 
             @Override
-            protected boolean removeEldestEntry(Map.Entry<String, NonceInfo> eldest) {
+            protected boolean removeEldestEntry(Map.Entry<String,NonceInfo> eldest) {
                 // This is called from a sync so keep it simple
                 long currentTime = System.currentTimeMillis();
                 if (size() > getNonceCacheSize()) {
@@ -495,7 +497,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
         private final String opaque;
         private final long nonceValidity;
         private final String key;
-        private final Map<String, NonceInfo> nonces;
+        private final Map<String,NonceInfo> nonces;
         private boolean validateUri = true;
 
         private String userName = null;
@@ -513,7 +515,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
         private AuthDigest algorithm = null;
 
 
-        public DigestInfo(String opaque, long nonceValidity, String key, Map<String, NonceInfo> nonces,
+        public DigestInfo(String opaque, long nonceValidity, String key, Map<String,NonceInfo> nonces,
                 boolean validateUri) {
             this.opaque = opaque;
             this.nonceValidity = nonceValidity;
@@ -534,7 +536,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
                 return false;
             }
 
-            Map<String, String> directives;
+            Map<String,String> directives;
             try {
                 directives = Authorization.parseAuthorizationDigest(new StringReader(authorization));
             } catch (IOException e) {
@@ -636,8 +638,8 @@ public class DigestAuthenticator extends AuthenticatorBase {
             }
             String serverIpTimeKey = request.getRemoteAddr() + ":" + nonceTime + ":" + key;
             // Note: The digest used to generate the nonce is independent of the the digest used for authentication/
-            byte[] buffer = ConcurrentMessageDigest.digest(NONCE_DIGEST,
-                    serverIpTimeKey.getBytes(StandardCharsets.ISO_8859_1));
+            byte[] buffer =
+                    ConcurrentMessageDigest.digest(NONCE_DIGEST, serverIpTimeKey.getBytes(StandardCharsets.ISO_8859_1));
             String digestServerIpTimeKey = HexUtils.toHexString(buffer);
             if (!digestServerIpTimeKey.equals(digestclientIpTimeKey)) {
                 return false;
@@ -703,8 +705,8 @@ public class DigestAuthenticator extends AuthenticatorBase {
                     ConcurrentMessageDigest.digest(algorithm.getJavaName(), a2.getBytes(StandardCharsets.ISO_8859_1));
             String digestA2 = HexUtils.toHexString(buffer);
 
-            return realm.authenticate(
-                    userName, response, nonce, nc, cnonce, qop, realmName, digestA2, algorithm.getJavaName());
+            return realm.authenticate(userName, response, nonce, nc, cnonce, qop, realmName, digestA2,
+                    algorithm.getJavaName());
         }
 
     }
diff --git a/java/org/apache/catalina/authenticator/SavedRequest.java b/java/org/apache/catalina/authenticator/SavedRequest.java
index 6b8956ffa6..f7c5dca2c0 100644
--- a/java/org/apache/catalina/authenticator/SavedRequest.java
+++ b/java/org/apache/catalina/authenticator/SavedRequest.java
@@ -60,7 +60,7 @@ public final class SavedRequest implements Serializable {
      * The set of Headers associated with this Request. Each key is a header name, while the value is a List containing
      * one or more actual values for this header. The values are returned as an Iterator when you ask for them.
      */
-    private final Map<String, List<String>> headers = new HashMap<>();
+    private final Map<String,List<String>> headers = new HashMap<>();
 
     public void addHeader(String name, String value) {
         List<String> values = headers.get(name);
diff --git a/java/org/apache/catalina/authenticator/SingleSignOn.java b/java/org/apache/catalina/authenticator/SingleSignOn.java
index 7bd5a9393c..9d49fd8e1f 100644
--- a/java/org/apache/catalina/authenticator/SingleSignOn.java
+++ b/java/org/apache/catalina/authenticator/SingleSignOn.java
@@ -76,7 +76,7 @@ public class SingleSignOn extends ValveBase {
      * The cache of SingleSignOnEntry instances for authenticated Principals, keyed by the cookie value that is used to
      * select them.
      */
-    protected Map<String, SingleSignOnEntry> cache = new ConcurrentHashMap<>();
+    protected Map<String,SingleSignOnEntry> cache = new ConcurrentHashMap<>();
 
     /**
      * Indicates whether this valve should require a downstream Authenticator to reauthenticate each request, or if it
diff --git a/java/org/apache/catalina/authenticator/SingleSignOnEntry.java b/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
index 7842aabee3..bf1523b2df 100644
--- a/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
+++ b/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
@@ -52,7 +52,7 @@ public class SingleSignOnEntry implements Serializable {
     // Marked as transient so special handling can be applied to serialization
     private transient Principal principal = null;
 
-    private final ConcurrentMap<SingleSignOnSessionKey, SingleSignOnSessionKey> sessionKeys = new ConcurrentHashMap<>();
+    private final ConcurrentMap<SingleSignOnSessionKey,SingleSignOnSessionKey> sessionKeys = new ConcurrentHashMap<>();
 
     private String username = null;
 
@@ -171,8 +171,8 @@ public class SingleSignOnEntry implements Serializable {
         this.authType = authType;
         this.username = username;
         this.password = password;
-        this.canReauthenticate = (HttpServletRequest.BASIC_AUTH.equals(authType) ||
-                HttpServletRequest.FORM_AUTH.equals(authType));
+        this.canReauthenticate =
+                (HttpServletRequest.BASIC_AUTH.equals(authType) || HttpServletRequest.FORM_AUTH.equals(authType));
     }
 
 
diff --git a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
index 6492a8f116..701124c6dc 100644
--- a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
+++ b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
@@ -403,7 +403,7 @@ public class SpnegoAuthenticator extends AuthenticatorBase {
             // Read the mechTypes into an ordered set
             int mechTypesLen = lengthAsInt();
             int mechTypesStart = pos;
-            LinkedHashMap<String, int[]> mechTypeEntries = new LinkedHashMap<>();
+            LinkedHashMap<String,int[]> mechTypeEntries = new LinkedHashMap<>();
             while (pos < mechTypesStart + mechTypesLen) {
                 int[] value = new int[2];
                 value[0] = pos;
diff --git a/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java b/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
index d9b1b1054a..10a7edb391 100644
--- a/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
+++ b/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
@@ -44,24 +44,19 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
     private static final StringManager sm = StringManager.getManager(AuthConfigFactoryImpl.class);
 
     private static final String CONFIG_PATH = "conf/jaspic-providers.xml";
-    private static final File CONFIG_FILE =
-            new File(System.getProperty(Globals.CATALINA_BASE_PROP), CONFIG_PATH);
+    private static final File CONFIG_FILE = new File(System.getProperty(Globals.CATALINA_BASE_PROP), CONFIG_PATH);
     private static final Object CONFIG_FILE_LOCK = new Object();
 
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
 
     private static String DEFAULT_REGISTRATION_ID = getRegistrationID(null, null);
 
-    private final Map<String,RegistrationContextImpl> layerAppContextRegistrations =
-            new ConcurrentHashMap<>();
-    private final Map<String,RegistrationContextImpl> appContextRegistrations =
-            new ConcurrentHashMap<>();
-    private final Map<String,RegistrationContextImpl> layerRegistrations =
-            new ConcurrentHashMap<>();
+    private final Map<String,RegistrationContextImpl> layerAppContextRegistrations = new ConcurrentHashMap<>();
+    private final Map<String,RegistrationContextImpl> appContextRegistrations = new ConcurrentHashMap<>();
+    private final Map<String,RegistrationContextImpl> layerRegistrations = new ConcurrentHashMap<>();
     // Note: Although there will only ever be a maximum of one entry in this
-    //       Map, use a ConcurrentHashMap for consistency
-    private final Map<String,RegistrationContextImpl> defaultRegistration =
-            new ConcurrentHashMap<>(1);
+    // Map, use a ConcurrentHashMap for consistency
+    private final Map<String,RegistrationContextImpl> defaultRegistration = new ConcurrentHashMap<>(1);
 
 
     public AuthConfigFactoryImpl() {
@@ -70,14 +65,11 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
 
 
     @Override
-    public AuthConfigProvider getConfigProvider(String layer, String appContext,
-            RegistrationListener listener) {
-        RegistrationContextImpl registrationContext =
-                findRegistrationContextImpl(layer, appContext);
+    public AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener listener) {
+        RegistrationContextImpl registrationContext = findRegistrationContextImpl(layer, appContext);
         if (registrationContext != null) {
             if (listener != null) {
-                RegistrationListenerWrapper wrapper = new RegistrationListenerWrapper(
-                        layer, appContext, listener);
+                RegistrationListenerWrapper wrapper = new RegistrationListenerWrapper(layer, appContext, listener);
                 registrationContext.addListener(wrapper);
             }
             return registrationContext.getProvider();
@@ -87,23 +79,19 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
 
 
     @Override
-    public String registerConfigProvider(String className,
-            @SuppressWarnings("rawtypes") Map properties, String layer, String appContext,
-            String description) {
-        String registrationID =
-                doRegisterConfigProvider(className, properties, layer, appContext, description);
+    public String registerConfigProvider(String className, @SuppressWarnings("rawtypes") Map properties, String layer,
+            String appContext, String description) {
+        String registrationID = doRegisterConfigProvider(className, properties, layer, appContext, description);
         savePersistentRegistrations();
         return registrationID;
     }
 
 
     @SuppressWarnings("unchecked")
-    private String doRegisterConfigProvider(String className,
-            @SuppressWarnings("rawtypes") Map properties, String layer, String appContext,
-            String description) {
+    private String doRegisterConfigProvider(String className, @SuppressWarnings("rawtypes") Map properties,
+            String layer, String appContext, String description) {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("authConfigFactoryImpl.registerClass",
-                    className, layer, appContext));
+            log.debug(sm.getString("authConfigFactoryImpl.registerClass", className, layer, appContext));
         }
 
         AuthConfigProvider provider = null;
@@ -112,15 +100,15 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
         }
 
         String registrationID = getRegistrationID(layer, appContext);
-        RegistrationContextImpl registrationContextImpl = new RegistrationContextImpl(
-                layer, appContext, description, true, provider, properties);
+        RegistrationContextImpl registrationContextImpl =
+                new RegistrationContextImpl(layer, appContext, description, true, provider, properties);
         addRegistrationContextImpl(layer, appContext, registrationID, registrationContextImpl);
         return registrationID;
     }
 
 
-    private AuthConfigProvider createAuthConfigProvider(String className,
-            @SuppressWarnings("rawtypes") Map properties) throws SecurityException {
+    private AuthConfigProvider createAuthConfigProvider(String className, @SuppressWarnings("rawtypes") Map properties)
+            throws SecurityException {
         Class<?> clazz = null;
         AuthConfigProvider provider = null;
         try {
@@ -142,22 +130,22 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
 
 
     @Override
-    public String registerConfigProvider(AuthConfigProvider provider, String layer,
-            String appContext, String description) {
+    public String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext,
+            String description) {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("authConfigFactoryImpl.registerInstance",
-                    provider.getClass().getName(), layer, appContext));
+            log.debug(sm.getString("authConfigFactoryImpl.registerInstance", provider.getClass().getName(), layer,
+                    appContext));
         }
         String registrationID = getRegistrationID(layer, appContext);
-        RegistrationContextImpl registrationContextImpl = new RegistrationContextImpl(
-                layer, appContext, description, false, provider, null);
+        RegistrationContextImpl registrationContextImpl =
+                new RegistrationContextImpl(layer, appContext, description, false, provider, null);
         addRegistrationContextImpl(layer, appContext, registrationID, registrationContextImpl);
         return registrationID;
     }
 
 
-    private void addRegistrationContextImpl(String layer, String appContext,
-            String registrationID, RegistrationContextImpl registrationContextImpl) {
+    private void addRegistrationContextImpl(String layer, String appContext, String registrationID,
+            RegistrationContextImpl registrationContextImpl) {
         RegistrationContextImpl previous = null;
 
         // Add the registration, noting any registration it replaces
@@ -180,12 +168,10 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
                 // Need to check existing appContext registrations
                 // (and layer and default)
                 // appContext must match
-                RegistrationContextImpl registration =
-                        appContextRegistrations.get(getRegistrationID(null, appContext));
+                RegistrationContextImpl registration = appContextRegistrations.get(getRegistrationID(null, appContext));
                 if (registration != null) {
                     for (RegistrationListenerWrapper wrapper : registration.listeners) {
-                        if (layer.equals(wrapper.getMessageLayer()) &&
-                                appContext.equals(wrapper.getAppContext())) {
+                        if (layer.equals(wrapper.getMessageLayer()) && appContext.equals(wrapper.getAppContext())) {
                             registration.listeners.remove(wrapper);
                             wrapper.listener.notify(wrapper.messageLayer, wrapper.appContext);
                         }
@@ -237,7 +223,7 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
             registration = layerAppContextRegistrations.remove(registrationID);
         }
         if (registration == null) {
-            registration =  appContextRegistrations.remove(registrationID);
+            registration = appContextRegistrations.remove(registrationID);
         }
         if (registration == null) {
             registration = layerRegistrations.remove(registrationID);
@@ -288,8 +274,8 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
     }
 
 
-    private void findProvider(AuthConfigProvider provider,
-            Map<String,RegistrationContextImpl> registrations, List<String> result) {
+    private void findProvider(AuthConfigProvider provider, Map<String,RegistrationContextImpl> registrations,
+            List<String> result) {
         for (Entry<String,RegistrationContextImpl> entry : registrations.entrySet()) {
             if (provider.equals(entry.getValue().getProvider())) {
                 result.add(entry.getKey());
@@ -322,12 +308,10 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
 
     private static String getRegistrationID(String layer, String appContext) {
         if (layer != null && layer.length() == 0) {
-            throw new IllegalArgumentException(
-                    sm.getString("authConfigFactoryImpl.zeroLengthMessageLayer"));
+            throw new IllegalArgumentException(sm.getString("authConfigFactoryImpl.zeroLengthMessageLayer"));
         }
         if (appContext != null && appContext.length() == 0) {
-            throw new IllegalArgumentException(
-                    sm.getString("authConfigFactoryImpl.zeroLengthAppContext"));
+            throw new IllegalArgumentException(sm.getString("authConfigFactoryImpl.zeroLengthAppContext"));
         }
         return (layer == null ? "" : layer) + ":" + (appContext == null ? "" : appContext);
     }
@@ -336,16 +320,15 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
     private void loadPersistentRegistrations() {
         synchronized (CONFIG_FILE_LOCK) {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("authConfigFactoryImpl.load",
-                        CONFIG_FILE.getAbsolutePath()));
+                log.debug(sm.getString("authConfigFactoryImpl.load", CONFIG_FILE.getAbsolutePath()));
             }
             if (!CONFIG_FILE.isFile()) {
                 return;
             }
             Providers providers = PersistentProviderRegistrations.loadProviders(CONFIG_FILE);
             for (Provider provider : providers.getProviders()) {
-                doRegisterConfigProvider(provider.getClassName(), provider.getProperties(),
-                        provider.getLayer(), provider.getAppContext(), provider.getDescription());
+                doRegisterConfigProvider(provider.getClassName(), provider.getProperties(), provider.getLayer(),
+                        provider.getAppContext(), provider.getDescription());
             }
         }
     }
@@ -363,16 +346,14 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
     }
 
 
-    private void savePersistentProviders(Providers providers,
-            Map<String,RegistrationContextImpl> registrations) {
+    private void savePersistentProviders(Providers providers, Map<String,RegistrationContextImpl> registrations) {
         for (Entry<String,RegistrationContextImpl> entry : registrations.entrySet()) {
             savePersistentProvider(providers, entry.getValue());
         }
     }
 
 
-    private void savePersistentProvider(Providers providers,
-            RegistrationContextImpl registrationContextImpl) {
+    private void savePersistentProvider(Providers providers, RegistrationContextImpl registrationContextImpl) {
         if (registrationContextImpl != null && registrationContextImpl.isPersistent()) {
             Provider provider = new Provider();
             provider.setAppContext(registrationContextImpl.getAppContext());
@@ -407,8 +388,8 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
 
     private static class RegistrationContextImpl implements RegistrationContext {
 
-        private RegistrationContextImpl(String messageLayer, String appContext, String description,
-                boolean persistent, AuthConfigProvider provider, Map<String,String> properties) {
+        private RegistrationContextImpl(String messageLayer, String appContext, String description, boolean persistent,
+                AuthConfigProvider provider, Map<String,String> properties) {
             this.messageLayer = messageLayer;
             this.appContext = appContext;
             this.description = description;
@@ -489,8 +470,7 @@ public class AuthConfigFactoryImpl extends AuthConfigFactory {
         private final RegistrationListener listener;
 
 
-        RegistrationListenerWrapper(String messageLayer, String appContext,
-                RegistrationListener listener) {
+        RegistrationListenerWrapper(String messageLayer, String appContext, RegistrationListener listener) {
             this.messageLayer = messageLayer;
             this.appContext = appContext;
             this.listener = listener;
diff --git a/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java b/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
index d88ff80bf1..80029e2f8c 100644
--- a/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
+++ b/java/org/apache/catalina/authenticator/jaspic/CallbackHandlerImpl.java
@@ -73,18 +73,17 @@ public class CallbackHandlerImpl implements CallbackHandler, Contained {
                     if (container == null) {
                         log.warn(sm.getString("callbackHandlerImpl.containerMissing", callback.getClass().getName()));
                     } else if (container.getRealm() == null) {
-                        log.warn(sm.getString("callbackHandlerImpl.realmMissing",
-                                callback.getClass().getName(), container.getName()));
+                        log.warn(sm.getString("callbackHandlerImpl.realmMissing", callback.getClass().getName(),
+                                container.getName()));
                     } else {
                         PasswordValidationCallback pvc = (PasswordValidationCallback) callback;
-                        principal = container.getRealm().authenticate(pvc.getUsername(),
-                                String.valueOf(pvc.getPassword()));
+                        principal =
+                                container.getRealm().authenticate(pvc.getUsername(), String.valueOf(pvc.getPassword()));
                         pvc.setResult(principal != null);
                         subject = pvc.getSubject();
                     }
                 } else {
-                    log.error(sm.getString("callbackHandlerImpl.jaspicCallbackMissing",
-                            callback.getClass().getName()));
+                    log.error(sm.getString("callbackHandlerImpl.jaspicCallbackMissing", callback.getClass().getName()));
                 }
             }
 
diff --git a/java/org/apache/catalina/authenticator/jaspic/MessageInfoImpl.java b/java/org/apache/catalina/authenticator/jaspic/MessageInfoImpl.java
index 4d0ba64a7c..a9d793c713 100644
--- a/java/org/apache/catalina/authenticator/jaspic/MessageInfoImpl.java
+++ b/java/org/apache/catalina/authenticator/jaspic/MessageInfoImpl.java
@@ -30,7 +30,7 @@ public class MessageInfoImpl implements MessageInfo {
 
     public static final String IS_MANDATORY = "javax.security.auth.message.MessagePolicy.isMandatory";
 
-    private final Map<String, Object> map = new HashMap<>();
+    private final Map<String,Object> map = new HashMap<>();
     private HttpServletRequest request;
     private HttpServletResponse response;
 
@@ -63,8 +63,8 @@ public class MessageInfoImpl implements MessageInfo {
     @Override
     public void setRequestMessage(Object request) {
         if (!(request instanceof HttpServletRequest)) {
-            throw new IllegalArgumentException(sm.getString("authenticator.jaspic.badRequestType",
-                    request.getClass().getName()));
+            throw new IllegalArgumentException(
+                    sm.getString("authenticator.jaspic.badRequestType", request.getClass().getName()));
         }
         this.request = (HttpServletRequest) request;
     }
@@ -72,8 +72,8 @@ public class MessageInfoImpl implements MessageInfo {
     @Override
     public void setResponseMessage(Object response) {
         if (!(response instanceof HttpServletResponse)) {
-            throw new IllegalArgumentException(sm.getString("authenticator.jaspic.badResponseType",
-                    response.getClass().getName()));
+            throw new IllegalArgumentException(
+                    sm.getString("authenticator.jaspic.badResponseType", response.getClass().getName()));
         }
         this.response = (HttpServletResponse) response;
     }
diff --git a/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java b/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
index 145771ff9d..dbaf098da0 100644
--- a/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
+++ b/java/org/apache/catalina/authenticator/jaspic/PersistentProviderRegistrations.java
@@ -40,14 +40,12 @@ import org.apache.tomcat.util.res.StringManager;
 import org.xml.sax.SAXException;
 
 /**
- * Utility class for the loading and saving of JASPIC persistent provider
- * registrations.
+ * Utility class for the loading and saving of JASPIC persistent provider registrations.
  */
 final class PersistentProviderRegistrations {
 
     private static final Log log = LogFactory.getLog(PersistentProviderRegistrations.class);
-    private static final StringManager sm =
-            StringManager.getManager(PersistentProviderRegistrations.class);
+    private static final StringManager sm = StringManager.getManager(PersistentProviderRegistrations.class);
 
 
     private PersistentProviderRegistrations() {
@@ -100,15 +98,13 @@ final class PersistentProviderRegistrations {
         // Remove left over temporary files if present
         if (configFileOld.exists()) {
             if (configFileOld.delete()) {
-                throw new SecurityException(sm.getString(
-                        "persistentProviderRegistrations.existsDeleteFail",
+                throw new SecurityException(sm.getString("persistentProviderRegistrations.existsDeleteFail",
                         configFileOld.getAbsolutePath()));
             }
         }
         if (configFileNew.exists()) {
             if (configFileNew.delete()) {
-                throw new SecurityException(sm.getString(
-                        "persistentProviderRegistrations.existsDeleteFail",
+                throw new SecurityException(sm.getString("persistentProviderRegistrations.existsDeleteFail",
                         configFileNew.getAbsolutePath()));
             }
         }
@@ -116,9 +112,7 @@ final class PersistentProviderRegistrations {
         // Write out the providers to the temporary new file
         try (OutputStream fos = new FileOutputStream(configFileNew);
                 Writer writer = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
-            writer.write(
-                    "<?xml version='1.0' encoding='utf-8'?>\n" +
-                    "<jaspic-providers\n" +
+            writer.write("<?xml version='1.0' encoding='utf-8'?>\n" + "<jaspic-providers\n" +
                     "    xmlns=\"http://tomcat.apache.org/xml\"\n" +
                     "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                     "    xsi:schemaLocation=\"http://tomcat.apache.org/xml jaspic-providers.xsd\"\n" +
@@ -143,8 +137,7 @@ final class PersistentProviderRegistrations {
         } catch (IOException e) {
             if (!configFileNew.delete()) {
                 Log log = LogFactory.getLog(PersistentProviderRegistrations.class);
-                log.warn(sm.getString("persistentProviderRegistrations.deleteFail",
-                        configFileNew.getAbsolutePath()));
+                log.warn(sm.getString("persistentProviderRegistrations.deleteFail", configFileNew.getAbsolutePath()));
             }
             throw new SecurityException(e);
         }
@@ -166,8 +159,7 @@ final class PersistentProviderRegistrations {
         // Remove the old file
         if (configFileOld.exists() && !configFileOld.delete()) {
             Log log = LogFactory.getLog(PersistentProviderRegistrations.class);
-            log.warn(sm.getString("persistentProviderRegistrations.deleteFail",
-                    configFileOld.getAbsolutePath()));
+            log.warn(sm.getString("persistentProviderRegistrations.deleteFail", configFileOld.getAbsolutePath()));
         }
     }
 
@@ -205,6 +197,7 @@ final class PersistentProviderRegistrations {
         public String getClassName() {
             return className;
         }
+
         public void setClassName(String className) {
             this.className = className;
         }
@@ -213,6 +206,7 @@ final class PersistentProviderRegistrations {
         public String getLayer() {
             return layer;
         }
+
         public void setLayer(String layer) {
             this.layer = layer;
         }
@@ -221,6 +215,7 @@ final class PersistentProviderRegistrations {
         public String getAppContext() {
             return appContext;
         }
+
         public void setAppContext(String appContext) {
             this.appContext = appContext;
         }
@@ -229,6 +224,7 @@ final class PersistentProviderRegistrations {
         public String getDescription() {
             return description;
         }
+
         public void setDescription(String description) {
             this.description = description;
         }
@@ -237,9 +233,11 @@ final class PersistentProviderRegistrations {
         public void addProperty(Property property) {
             properties.put(property.getName(), property.getValue());
         }
+
         void addProperty(String name, String value) {
             properties.put(name, value);
         }
+
         public Map<String,String> getProperties() {
             return properties;
         }
@@ -254,6 +252,7 @@ final class PersistentProviderRegistrations {
         public String getName() {
             return name;
         }
+
         public void setName(String name) {
             this.name = name;
         }
@@ -262,6 +261,7 @@ final class PersistentProviderRegistrations {
         public String getValue() {
             return value;
         }
+
         public void setValue(String value) {
             this.value = value;
         }
diff --git a/java/org/apache/catalina/authenticator/jaspic/SimpleAuthConfigProvider.java b/java/org/apache/catalina/authenticator/jaspic/SimpleAuthConfigProvider.java
index 476e97822c..09af1567e0 100644
--- a/java/org/apache/catalina/authenticator/jaspic/SimpleAuthConfigProvider.java
+++ b/java/org/apache/catalina/authenticator/jaspic/SimpleAuthConfigProvider.java
@@ -27,8 +27,7 @@ import javax.security.auth.message.config.ServerAuthConfig;
 
 /**
  * Basic implementation primarily intended for use when using third-party
- * {@link javax.security.auth.message.module.ServerAuthModule} implementations
- * that only provide the module.
+ * {@link javax.security.auth.message.module.ServerAuthModule} implementations that only provide the module.
  */
 public class SimpleAuthConfigProvider implements AuthConfigProvider {
 
@@ -47,19 +46,18 @@ public class SimpleAuthConfigProvider implements AuthConfigProvider {
     /**
      * {@inheritDoc}
      * <p>
-     * This implementation does not support client-side authentication and
-     * therefore always returns {@code null}.
+     * This implementation does not support client-side authentication and therefore always returns {@code null}.
      */
     @Override
-    public ClientAuthConfig getClientAuthConfig(String layer, String appContext,
-            CallbackHandler handler) throws AuthException {
+    public ClientAuthConfig getClientAuthConfig(String layer, String appContext, CallbackHandler handler)
+            throws AuthException {
         return null;
     }
 
 
     @Override
-    public ServerAuthConfig getServerAuthConfig(String layer, String appContext,
-            CallbackHandler handler) throws AuthException {
+    public ServerAuthConfig getServerAuthConfig(String layer, String appContext, CallbackHandler handler)
+            throws AuthException {
         ServerAuthConfig serverAuthConfig = this.serverAuthConfig;
         if (serverAuthConfig == null) {
             synchronized (this) {
@@ -73,8 +71,8 @@ public class SimpleAuthConfigProvider implements AuthConfigProvider {
     }
 
 
-    protected ServerAuthConfig createServerAuthConfig(String layer, String appContext,
-            CallbackHandler handler, Map<String,String> properties) {
+    protected ServerAuthConfig createServerAuthConfig(String layer, String appContext, CallbackHandler handler,
+            Map<String,String> properties) {
         return new SimpleServerAuthConfig(layer, appContext, handler, properties);
     }
 
diff --git a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
index 15d29e109d..289b6f83af 100644
--- a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
+++ b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthConfig.java
@@ -32,10 +32,9 @@ import javax.security.auth.message.module.ServerAuthModule;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Basic implementation primarily intended for use when using third-party
- * {@link ServerAuthModule} implementations that only provide the module. This
- * implementation supports configuring the {@link ServerAuthContext} with
- * multiple modules.
+ * Basic implementation primarily intended for use when using third-party {@link ServerAuthModule} implementations that
+ * only provide the module. This implementation supports configuring the {@link ServerAuthContext} with multiple
+ * modules.
  */
 public class SimpleServerAuthConfig implements ServerAuthConfig {
 
@@ -90,10 +89,10 @@ public class SimpleServerAuthConfig implements ServerAuthConfig {
     }
 
 
-    @SuppressWarnings({"rawtypes", "unchecked"}) // JASPIC API uses raw types
+    @SuppressWarnings({ "rawtypes", "unchecked" }) // JASPIC API uses raw types
     @Override
-    public ServerAuthContext getAuthContext(String authContextID, Subject serviceSubject,
-            Map properties) throws AuthException {
+    public ServerAuthContext getAuthContext(String authContextID, Subject serviceSubject, Map properties)
+            throws AuthException {
         ServerAuthContext serverAuthContext = this.serverAuthContext;
         if (serverAuthContext == null) {
             synchronized (this) {
@@ -113,12 +112,10 @@ public class SimpleServerAuthConfig implements ServerAuthConfig {
                     while (moduleClassName != null) {
                         try {
                             Class<?> clazz = Class.forName(moduleClassName);
-                            ServerAuthModule module =
-                                    (ServerAuthModule) clazz.getConstructor().newInstance();
+                            ServerAuthModule module = (ServerAuthModule) clazz.getConstructor().newInstance();
                             module.initialize(null, null, handler, mergedProperties);
                             modules.add(module);
-                        } catch (ReflectiveOperationException | IllegalArgumentException |
-                                SecurityException e) {
+                        } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
                             AuthException ae = new AuthException();
                             ae.initCause(e);
                             throw ae;
diff --git a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthContext.java b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthContext.java
index d36cb0f9b6..d6da034558 100644
--- a/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthContext.java
+++ b/java/org/apache/catalina/authenticator/jaspic/SimpleServerAuthContext.java
@@ -26,10 +26,9 @@ import javax.security.auth.message.config.ServerAuthContext;
 import javax.security.auth.message.module.ServerAuthModule;
 
 /**
- * Basic implementation primarily intended for use when using third-party
- * {@link ServerAuthModule} implementations that only provide the module. This
- * implementation supports multiple modules and will treat the user as
- * authenticated if any one module is able to authenticate the user.
+ * Basic implementation primarily intended for use when using third-party {@link ServerAuthModule} implementations that
+ * only provide the module. This implementation supports multiple modules and will treat the user as authenticated if
+ * any one module is able to authenticate the user.
  */
 public class SimpleServerAuthContext implements ServerAuthContext {
 
@@ -43,8 +42,8 @@ public class SimpleServerAuthContext implements ServerAuthContext {
 
     @SuppressWarnings("unchecked") // JASPIC API uses raw types
     @Override
-    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject,
-            Subject serviceSubject) throws AuthException {
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject)
+            throws AuthException {
         for (int moduleIndex = 0; moduleIndex < modules.size(); moduleIndex++) {
             ServerAuthModule module = modules.get(moduleIndex);
             AuthStatus result = module.validateRequest(messageInfo, clientSubject, serviceSubject);
@@ -58,8 +57,7 @@ public class SimpleServerAuthContext implements ServerAuthContext {
 
 
     @Override
-    public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject)
-            throws AuthException {
+    public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException {
         ServerAuthModule module = modules.get(((Integer) messageInfo.getMap().get("moduleIndex")).intValue());
         return module.secureResponse(messageInfo, serviceSubject);
     }


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