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

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

commit 0694ca7d03f9dfbcb0afaae20b0cf5a1a2959baf
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Apr 14 11:32:21 2023 +0100

    Code clean-up - no functional change
---
 java/jakarta/security/auth/message/ClientAuth.java | 39 ++++++---------
 java/jakarta/security/auth/message/ServerAuth.java | 41 +++++++---------
 .../message/callback/CallerPrincipalCallback.java  |  4 +-
 .../auth/message/callback/CertStoreCallback.java   |  3 +-
 .../message/callback/GroupPrincipalCallback.java   |  3 +-
 .../callback/PasswordValidationCallback.java       |  4 +-
 .../auth/message/callback/PrivateKeyCallback.java  |  5 +-
 .../auth/message/callback/SecretKeyCallback.java   |  4 +-
 .../auth/message/callback/TrustStoreCallback.java  |  3 +-
 .../auth/message/config/AuthConfigFactory.java     | 57 ++++++++++------------
 .../auth/message/config/AuthConfigProvider.java    |  6 +--
 .../auth/message/module/ClientAuthModule.java      |  4 +-
 .../auth/message/module/ServerAuthModule.java      |  4 +-
 13 files changed, 76 insertions(+), 101 deletions(-)

diff --git a/java/jakarta/security/auth/message/ClientAuth.java 
b/java/jakarta/security/auth/message/ClientAuth.java
index 063075f35a..c4bf93ed14 100644
--- a/java/jakarta/security/auth/message/ClientAuth.java
+++ b/java/jakarta/security/auth/message/ClientAuth.java
@@ -24,45 +24,38 @@ public interface ClientAuth {
      * Secure (authenticate) the request.
      *
      * @param messageInfo   The associated request and response
-     * @param clientSubject The subject that represents the source of the
-     *                      request
+     * @param clientSubject The subject that represents the source of the 
request
      *
-     * @return An AuthStatus instance that represents the result of the
-     *         authentication
+     * @return An AuthStatus instance that represents the result of the 
authentication
      *
-     * @throws AuthException If the a failure occurred in a manner that
-     *                       prevented the failure from being communicated via
-     *                       messageInfo
+     * @throws AuthException If the a failure occurred in a manner that 
prevented the failure from being communicated
+     *                           via messageInfo
      */
     AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) 
throws AuthException;
 
     /**
      * Validate a response.
      *
-     * @param messageInfo       The associated request and response
-     * @param clientSubject     The subject that represents the recipient of 
the
-     *                          response
-     * @param serviceSubject    The subject that represents the source of the
-     *                          response
+     * @param messageInfo    The associated request and response
+     * @param clientSubject  The subject that represents the recipient of the 
response
+     * @param serviceSubject The subject that represents the source of the 
response
      *
-     * @return An AuthStatus instance that represents the result of the
-     *         validation
+     * @return An AuthStatus instance that represents the result of the 
validation
      *
-     * @throws AuthException If the a failure occurred in a manner that
-     *                       prevented the failure from being communicated via
-     *                       messageInfo
+     * @throws AuthException If the a failure occurred in a manner that 
prevented the failure from being communicated
+     *                           via messageInfo
      */
-    default AuthStatus validateResponse(MessageInfo messageInfo, Subject 
clientSubject,
-            Subject serviceSubject) throws AuthException {
+    default AuthStatus validateResponse(MessageInfo messageInfo, Subject 
clientSubject, Subject serviceSubject)
+            throws AuthException {
         return AuthStatus.SUCCESS;
     }
 
     /**
-     * Remove principals and/or credentials from the subject that were
-     * previously added by this authentication mechanism.
+     * Remove principals and/or credentials from the subject that were 
previously added by this authentication
+     * mechanism.
      *
-     * @param messageInfo   The associated request and response
-     * @param subject       The subject to clean
+     * @param messageInfo The associated request and response
+     * @param subject     The subject to clean
      *
      * @throws AuthException If the a failure occurred
      */
diff --git a/java/jakarta/security/auth/message/ServerAuth.java 
b/java/jakarta/security/auth/message/ServerAuth.java
index d0777618f5..84141ade22 100644
--- a/java/jakarta/security/auth/message/ServerAuth.java
+++ b/java/jakarta/security/auth/message/ServerAuth.java
@@ -23,46 +23,39 @@ public interface ServerAuth {
     /**
      * Validate the request.
      *
-     * @param messageInfo       The associated request and response
-     * @param clientSubject     The subject that represents the source of the
-     *                          request
-     * @param serviceSubject    The subject that represents the recipient of 
the
-     *                          request
+     * @param messageInfo    The associated request and response
+     * @param clientSubject  The subject that represents the source of the 
request
+     * @param serviceSubject The subject that represents the recipient of the 
request
      *
-     * @return An AuthStatus instance that represents the result of the
-     *         validation
+     * @return An AuthStatus instance that represents the result of the 
validation
      *
-     * @throws AuthException If the a failure occurred in a manner that
-     *                       prevented the failure from being communicated via
-     *                       messageInfo
+     * @throws AuthException If the a failure occurred in a manner that 
prevented the failure from being communicated
+     *                           via messageInfo
      */
-    AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject,
-            Subject serviceSubject) throws AuthException;
+    AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, 
Subject serviceSubject)
+            throws AuthException;
 
     /**
      * Secure (authenticate) the response.
      *
-     * @param messageInfo       The associated request and response
-     * @param serviceSubject    The subject that represents the source of the
-     *                          response
+     * @param messageInfo    The associated request and response
+     * @param serviceSubject The subject that represents the source of the 
response
      *
-     * @return An AuthStatus instance that represents the result of the
-     *         authentication
+     * @return An AuthStatus instance that represents the result of the 
authentication
      *
-     * @throws AuthException If the a failure occurred in a manner that
-     *                       prevented the failure from being communicated via
-     *                       messageInfo
+     * @throws AuthException If the a failure occurred in a manner that 
prevented the failure from being communicated
+     *                           via messageInfo
      */
     default AuthStatus secureResponse(MessageInfo messageInfo, Subject 
serviceSubject) throws AuthException {
         return AuthStatus.SUCCESS;
     }
 
     /**
-     * Remove principals and/or credentials from the subject that were
-     * previously added by this authentication mechanism.
+     * Remove principals and/or credentials from the subject that were 
previously added by this authentication
+     * mechanism.
      *
-     * @param messageInfo   The associated request and response
-     * @param subject       The subject to clean
+     * @param messageInfo The associated request and response
+     * @param subject     The subject to clean
      *
      * @throws AuthException If the a failure occurred
      */
diff --git 
a/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java 
b/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java
index 12ec34d2d0..a7a5f8059c 100644
--- a/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java
+++ b/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java
@@ -22,8 +22,8 @@ import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 
 /**
- * Callback that enables an authentication module to inform the runtime of the
- * call principal or name of the caller principal.
+ * Callback that enables an authentication module to inform the runtime of the 
call principal or name of the caller
+ * principal.
  */
 public class CallerPrincipalCallback implements Callback {
 
diff --git a/java/jakarta/security/auth/message/callback/CertStoreCallback.java 
b/java/jakarta/security/auth/message/callback/CertStoreCallback.java
index fde112982f..5a9455b525 100644
--- a/java/jakarta/security/auth/message/callback/CertStoreCallback.java
+++ b/java/jakarta/security/auth/message/callback/CertStoreCallback.java
@@ -21,8 +21,7 @@ import java.security.cert.CertStore;
 import javax.security.auth.callback.Callback;
 
 /**
- * Callback that enables a runtime to inform authentication modules of the
- * CertStore to use.
+ * Callback that enables a runtime to inform authentication modules of the 
CertStore to use.
  */
 public class CertStoreCallback implements Callback {
 
diff --git 
a/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java 
b/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java
index 738878abc9..ea5d2eb89f 100644
--- a/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java
+++ b/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java
@@ -20,8 +20,7 @@ import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 
 /**
- * Callback that enables an authentication module to inform the runtime of the
- * groups a user is in.
+ * Callback that enables an authentication module to inform the runtime of the 
groups a user is in.
  */
 public class GroupPrincipalCallback implements Callback {
 
diff --git 
a/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java 
b/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java
index 5c8fb200bf..9840375acd 100644
--- 
a/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java
+++ 
b/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java
@@ -22,8 +22,8 @@ import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 
 /**
- * Callback that enables an authentication module to supply a user name and
- * password (to a runtime?) and determine if the result of validation.
+ * Callback that enables an authentication module to supply a user name and 
password (to a runtime?) and determine if
+ * the result of validation.
  */
 public class PasswordValidationCallback implements Callback {
 
diff --git 
a/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java 
b/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java
index c489c5166f..dffcb0bed9 100644
--- a/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java
+++ b/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java
@@ -24,9 +24,8 @@ import javax.security.auth.callback.Callback;
 import javax.security.auth.x500.X500Principal;
 
 /**
- * Callback that enables an authentication module to request a certificate 
chain
- * and private key from the runtime. The information specifying the chain and
- * key may be an alias, a digest, a subject key, or an issuer ID. Other request
+ * Callback that enables an authentication module to request a certificate 
chain and private key from the runtime. The
+ * information specifying the chain and key may be an alias, a digest, a 
subject key, or an issuer ID. Other request
  * types may be supported.
  */
 public class PrivateKeyCallback implements Callback {
diff --git a/java/jakarta/security/auth/message/callback/SecretKeyCallback.java 
b/java/jakarta/security/auth/message/callback/SecretKeyCallback.java
index 7e16ea42da..95dd48851d 100644
--- a/java/jakarta/security/auth/message/callback/SecretKeyCallback.java
+++ b/java/jakarta/security/auth/message/callback/SecretKeyCallback.java
@@ -20,8 +20,8 @@ import javax.crypto.SecretKey;
 import javax.security.auth.callback.Callback;
 
 /**
- * A callback enabling an authentication module to request a secret key from 
the
- * runtime, by supplying an alias. Other request types may also be supported.
+ * A callback enabling an authentication module to request a secret key from 
the runtime, by supplying an alias. Other
+ * request types may also be supported.
  */
 public class SecretKeyCallback implements Callback {
 
diff --git 
a/java/jakarta/security/auth/message/callback/TrustStoreCallback.java 
b/java/jakarta/security/auth/message/callback/TrustStoreCallback.java
index ca35e37ce7..64ab85678f 100644
--- a/java/jakarta/security/auth/message/callback/TrustStoreCallback.java
+++ b/java/jakarta/security/auth/message/callback/TrustStoreCallback.java
@@ -21,8 +21,7 @@ import java.security.KeyStore;
 import javax.security.auth.callback.Callback;
 
 /**
- * A Callback enabling an authentication module to request a truststore from 
the
- * runtime.
+ * A Callback enabling an authentication module to request a truststore from 
the runtime.
  */
 public class TrustStoreCallback implements Callback {
 
diff --git a/java/jakarta/security/auth/message/config/AuthConfigFactory.java 
b/java/jakarta/security/auth/message/config/AuthConfigFactory.java
index f58a1e4b0c..7ecaa3ab3c 100644
--- a/java/jakarta/security/auth/message/config/AuthConfigFactory.java
+++ b/java/jakarta/security/auth/message/config/AuthConfigFactory.java
@@ -73,24 +73,23 @@ public abstract class AuthConfigFactory {
             if (factory == null) {
                 final String className = getFactoryClassName();
                 try {
-                    factory = AccessController.doPrivileged(
-                            (PrivilegedExceptionAction<AuthConfigFactory>) () 
-> {
-                                // Load this class with the same class loader 
as used for
-                                // this class. Note that the Thread context 
class loader
-                                // should not be used since that would trigger 
a memory leak
-                                // in container environments.
-                                if 
(className.equals("org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl"))
 {
-                                    return new 
org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl();
-                                } else {
-                                    Class<?> clazz = Class.forName(className);
-                                    return (AuthConfigFactory) 
clazz.getConstructor().newInstance();
-                                }
-                            });
+                    factory = 
AccessController.doPrivileged((PrivilegedExceptionAction<AuthConfigFactory>) () 
-> {
+                        // Load this class with the same class loader as used 
for
+                        // this class. Note that the Thread context class 
loader
+                        // should not be used since that would trigger a 
memory leak
+                        // in container environments.
+                        if 
(className.equals("org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl"))
 {
+                            return new 
org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl();
+                        } else {
+                            Class<?> clazz = Class.forName(className);
+                            return (AuthConfigFactory) 
clazz.getConstructor().newInstance();
+                        }
+                    });
                 } catch (PrivilegedActionException e) {
                     Exception inner = e.getException();
                     if (inner instanceof InstantiationException) {
-                        throw new SecurityException("AuthConfigFactory error:" 
+
-                                inner.getCause().getMessage(), 
inner.getCause());
+                        throw new SecurityException("AuthConfigFactory error:" 
+ inner.getCause().getMessage(),
+                                inner.getCause());
                     } else {
                         throw new SecurityException("AuthConfigFactory error: 
" + inner, inner);
                     }
@@ -112,13 +111,12 @@ public abstract class AuthConfigFactory {
     public abstract String registerConfigProvider(String className, 
Map<String,String> properties, String layer,
             String appContext, String description);
 
-    public abstract String registerConfigProvider(AuthConfigProvider provider, 
String layer,
-            String appContext, String description);
+    public abstract String registerConfigProvider(AuthConfigProvider provider, 
String layer, String appContext,
+            String description);
 
     public abstract boolean removeRegistration(String registrationID);
 
-    public abstract String[] detachListener(RegistrationListener listener, 
String layer,
-            String appContext);
+    public abstract String[] detachListener(RegistrationListener listener, 
String layer, String appContext);
 
     public abstract String[] getRegistrationIDs(AuthConfigProvider provider);
 
@@ -127,14 +125,12 @@ public abstract class AuthConfigFactory {
     public abstract void refresh();
 
     /**
-     * Convenience method for registering a {@link ServerAuthModule} that 
should
-     * have the same effect as calling {@link
-     * #registerConfigProvider(AuthConfigProvider, String, String, String)} 
with
-     * the implementation providing the appropriate {@link AuthConfigProvider}
-     * generated from the provided context.
+     * Convenience method for registering a {@link ServerAuthModule} that 
should have the same effect as calling
+     * {@link #registerConfigProvider(AuthConfigProvider, String, String, 
String)} with the implementation providing the
+     * appropriate {@link AuthConfigProvider} generated from the provided 
context.
      *
-     * @param serverAuthModule  The {@link ServerAuthModule} to register
-     * @param context           The associated application context
+     * @param serverAuthModule The {@link ServerAuthModule} to register
+     * @param context          The associated application context
      *
      * @return A string identifier for the created registration
      *
@@ -143,11 +139,10 @@ public abstract class AuthConfigFactory {
     public abstract String registerServerAuthModule(ServerAuthModule 
serverAuthModule, Object context);
 
     /**
-     * Convenience method for deregistering a {@link ServerAuthModule} that
-     * should have the same effect as calling
+     * Convenience method for deregistering a {@link ServerAuthModule} that 
should have the same effect as calling
      * {@link AuthConfigFactory#removeRegistration(String)}.
      *
-     * @param context           The associated application context
+     * @param context The associated application context
      *
      * @since Authentication 3.0
      */
@@ -165,8 +160,8 @@ public abstract class AuthConfigFactory {
     }
 
     private static String getFactoryClassName() {
-        String className = AccessController.doPrivileged(
-                (PrivilegedAction<String>) () -> 
Security.getProperty(DEFAULT_FACTORY_SECURITY_PROPERTY));
+        String className = AccessController
+                .doPrivileged((PrivilegedAction<String>) () -> 
Security.getProperty(DEFAULT_FACTORY_SECURITY_PROPERTY));
 
         if (className != null) {
             return className;
diff --git a/java/jakarta/security/auth/message/config/AuthConfigProvider.java 
b/java/jakarta/security/auth/message/config/AuthConfigProvider.java
index 99a47a3dab..3aa912dca6 100644
--- a/java/jakarta/security/auth/message/config/AuthConfigProvider.java
+++ b/java/jakarta/security/auth/message/config/AuthConfigProvider.java
@@ -22,11 +22,9 @@ import jakarta.security.auth.message.AuthException;
 
 public interface AuthConfigProvider {
 
-    ClientAuthConfig getClientAuthConfig(String layer, String appContext, 
CallbackHandler handler)
-            throws AuthException;
+    ClientAuthConfig getClientAuthConfig(String layer, String appContext, 
CallbackHandler handler) throws AuthException;
 
-    ServerAuthConfig getServerAuthConfig(String layer, String appContext, 
CallbackHandler handler)
-            throws AuthException;
+    ServerAuthConfig getServerAuthConfig(String layer, String appContext, 
CallbackHandler handler) throws AuthException;
 
     void refresh();
 }
diff --git a/java/jakarta/security/auth/message/module/ClientAuthModule.java 
b/java/jakarta/security/auth/message/module/ClientAuthModule.java
index ab436510e1..b7fa96a006 100644
--- a/java/jakarta/security/auth/message/module/ClientAuthModule.java
+++ b/java/jakarta/security/auth/message/module/ClientAuthModule.java
@@ -26,8 +26,8 @@ import jakarta.security.auth.message.MessagePolicy;
 
 public interface ClientAuthModule extends ClientAuth {
 
-    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy,
-            CallbackHandler handler, Map<String,Object> options) throws 
AuthException;
+    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, 
CallbackHandler handler,
+            Map<String,Object> options) throws AuthException;
 
     Class<?>[] getSupportedMessageTypes();
 }
diff --git a/java/jakarta/security/auth/message/module/ServerAuthModule.java 
b/java/jakarta/security/auth/message/module/ServerAuthModule.java
index d408e139c8..8c658730ab 100644
--- a/java/jakarta/security/auth/message/module/ServerAuthModule.java
+++ b/java/jakarta/security/auth/message/module/ServerAuthModule.java
@@ -26,8 +26,8 @@ import jakarta.security.auth.message.ServerAuth;
 
 public interface ServerAuthModule extends ServerAuth {
 
-    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy,
-            CallbackHandler handler, Map<String,Object> options) throws 
AuthException;
+    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, 
CallbackHandler handler,
+            Map<String,Object> options) throws AuthException;
 
     Class<?>[] getSupportedMessageTypes();
 }


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

Reply via email to