geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r433122 - in /geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message: ./ callback/ config/ module/
Date Mon, 21 Aug 2006 02:25:41 GMT
Author: gnodet
Date: Sun Aug 20 19:25:40 2006
New Revision: 433122

URL: http://svn.apache.org/viewvc?rev=433122&view=rev
Log:
Fix some problems wrt to the jaspi spec

Modified:
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/AuthStatus.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ClientAuth.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/MessagePolicy.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ServerAuth.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PasswordValidationCallback.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PrivateKeyCallback.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfig.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigFactory.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigProvider.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthConfig.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthContext.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ServerAuthConfig.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ClientAuthModule.java
    geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ServerAuthModule.java

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/AuthStatus.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/AuthStatus.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/AuthStatus.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/AuthStatus.java
Sun Aug 20 19:25:40 2006
@@ -22,9 +22,9 @@
  */
 public class AuthStatus {
 
-    static AuthStatus FAILURE = new AuthStatus();
-    static AuthStatus SEND_CONTINUE = new AuthStatus();
-    static AuthStatus SEND_FAILURE = new AuthStatus();
-    static AuthStatus SEND_SUCCESS = new AuthStatus();
-    static AuthStatus SUCCESS = new AuthStatus();
+    public static final AuthStatus FAILURE = new AuthStatus();
+    public static final AuthStatus SEND_CONTINUE = new AuthStatus();
+    public static final AuthStatus SEND_FAILURE = new AuthStatus();
+    public static final AuthStatus SEND_SUCCESS = new AuthStatus();
+    public static final AuthStatus SUCCESS = new AuthStatus();
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ClientAuth.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ClientAuth.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ClientAuth.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ClientAuth.java
Sun Aug 20 19:25:40 2006
@@ -24,9 +24,9 @@
  */
 public interface ClientAuth {
 
-    void cleanSubject(MessageInfo messageInfo, Subject subject);
+    void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException;
 
-    AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject);
+    AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) throws AuthException;
 
-    AuthStatus validateResponse(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject);
+    AuthStatus validateResponse(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject)
throws AuthException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/MessagePolicy.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/MessagePolicy.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/MessagePolicy.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/MessagePolicy.java
Sun Aug 20 19:25:40 2006
@@ -25,12 +25,18 @@
     private final TargetPolicy[] targetPolicies;
     private final boolean mandatory;
 
-    public MessagePolicy(TargetPolicy[] targetPolicies, boolean mandatory) {
+    public MessagePolicy(TargetPolicy[] targetPolicies, boolean mandatory) throws IllegalArgumentException
{
+        if (targetPolicies == null) {
+            throw new IllegalArgumentException("targetPolicies is null");
+        }
         this.targetPolicies = targetPolicies;
         this.mandatory = mandatory;
     }
 
     public TargetPolicy[] getTargetPolicies() {
+        if (targetPolicies.length == 0) {
+            return null;
+        }
         return targetPolicies;
     }
 
@@ -61,12 +67,21 @@
         private final Target[] targets;
         private final ProtectionPolicy protectionPolicy;
 
-        public TargetPolicy(Target[] targets, ProtectionPolicy protectionPolicy) {
+        public TargetPolicy(Target[] targets, ProtectionPolicy protectionPolicy) throws IllegalArgumentException
{
+            if (targets == null) {
+                throw new IllegalArgumentException("targets is null");
+            }
+            if (protectionPolicy == null) {
+                throw new IllegalArgumentException("protectionPolicy is null");
+            }
             this.targets = targets;
             this.protectionPolicy = protectionPolicy;
         }
 
         public Target[] getTargets() {
+            if (targets.length == 0) {
+                return null;
+            }
             return targets;
         }
 

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ServerAuth.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ServerAuth.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ServerAuth.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/ServerAuth.java
Sun Aug 20 19:25:40 2006
@@ -24,9 +24,9 @@
  */
 public interface ServerAuth {
 
-    void cleanSubject(MessageInfo messageInfo, Subject subject);
+    void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException;
 
-    AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject);
+    AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException;
 
-    AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject);
+    AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject)
throws AuthException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PasswordValidationCallback.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PasswordValidationCallback.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PasswordValidationCallback.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PasswordValidationCallback.java
Sun Aug 20 19:25:40 2006
@@ -39,11 +39,7 @@
     }
 
     public char[] getPassword() {
-        char[] result = new char[password.length];
-
-        System.arraycopy(password, 0, result, 0, password.length);
-
-        return result;
+        return password;
     }
 
     public void clearPassword() {

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PrivateKeyCallback.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PrivateKeyCallback.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PrivateKeyCallback.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/callback/PrivateKeyCallback.java
Sun Aug 20 19:25:40 2006
@@ -56,7 +56,7 @@
     public static interface Request {
     }
 
-    static class AliasRequest implements Request {
+    public static class AliasRequest implements Request {
 
         private final String alias;
 

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfig.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfig.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfig.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfig.java
Sun Aug 20 19:25:40 2006
@@ -17,6 +17,7 @@
  */
 package javax.security.auth.message.config;
 
+import javax.security.auth.message.AuthException;
 import javax.security.auth.message.MessageInfo;
 
 /**
@@ -24,11 +25,11 @@
  */
 public interface AuthConfig {
 
-    java.lang.String getAppContext();
+    String getAppContext();
 
-    java.lang.String getMessageLayer();
+    String getMessageLayer();
 
-    java.lang.String getOperation(MessageInfo messageInfo);
+    String getOperation(MessageInfo messageInfo) throws IllegalArgumentException;
 
-    void refresh();
+    void refresh() throws AuthException, SecurityException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigFactory.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigFactory.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigFactory.java
Sun Aug 20 19:25:40 2006
@@ -17,36 +17,87 @@
  */
 package javax.security.auth.message.config;
 
+import java.security.PrivilegedActionException;
 import java.util.Map;
 
+import javax.security.auth.AuthPermission;
+import javax.security.auth.message.AuthException;
+
 /**
  * @version $Rev$ $Date$
  */
 public abstract class AuthConfigFactory {
 
     private static AuthConfigFactory factory;
+    private static ClassLoader contextClassLoader;
 
-    static AuthConfigFactory getFactory() {
-        return AuthConfigFactory.factory;
+    static {
+        contextClassLoader = (ClassLoader) java.security.AccessController
+                        .doPrivileged(new java.security.PrivilegedAction() {
+                            public Object run() {
+                                return Thread.currentThread().getContextClassLoader();
+                            }
+                        });
+    };
+    
+    public static AuthConfigFactory getFactory() throws AuthException, SecurityException
{
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new AuthPermission("getAuthConfigFactory"));
+        }
+        if (factory == null) {
+            String className = (String) java.security.AccessController
+                            .doPrivileged(new java.security.PrivilegedAction() {
+                                public Object run() {
+                                    return java.security.Security.getProperty("authconfigprovider.factory");
+                                }
+                            });
+            if (className == null) {
+                className = "org.apache.geronimo.jaspi.AuthConfigFactoryImpl";
+            }
+            try {
+                final String finalClassName = className;
+                factory = (AuthConfigFactory) java.security.AccessController
+                                .doPrivileged(new java.security.PrivilegedExceptionAction()
{
+                                    public Object run() throws ClassNotFoundException, InstantiationException,
+                                                    IllegalAccessException {
+                                        return Class.forName(finalClassName, true, contextClassLoader).newInstance();
+                                    }
+                                });
+            } catch (PrivilegedActionException e) {
+                Exception inner = e.getException();
+                if (inner instanceof InstantiationException) {
+                    throw (SecurityException) new SecurityException("AuthConfigFactory error:"
+                                    + inner.getCause().getMessage(), inner.getCause());
+                } else {
+                    throw (SecurityException) new SecurityException("AuthConfigFactory error:
" + inner, inner);
+                }
+            }
+        }
+        return factory;
     }
 
-    static void setFactory(AuthConfigFactory factory) {
+    public static void setFactory(AuthConfigFactory factory) throws SecurityException {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new AuthPermission("setAuthConfigFactory"));
+        }
         AuthConfigFactory.factory = factory;
     }
 
-    abstract String[] detachListener(RegistrationListener listener, String layer, String
appContext);
+    public abstract String[] detachListener(RegistrationListener listener, String layer,
String appContext) throws SecurityException;
 
-    abstract AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener
listener);
+    public abstract AuthConfigProvider getConfigProvider(String layer, String appContext,
RegistrationListener listener);
 
-    abstract RegistrationContext getRegistrationContext(String registrationID);
+    public abstract RegistrationContext getRegistrationContext(String registrationID);
 
-    abstract String[] getRegistrationIDs(AuthConfigProvider provider);
+    public abstract String[] getRegistrationIDs(AuthConfigProvider provider);
 
-    abstract void refresh();
+    public abstract void refresh() throws AuthException, SecurityException;
 
-    abstract String registerConfigProvider(String className, Map properties, String layer,
String appContext, String description);
+    public abstract String registerConfigProvider(String className, Map properties, String
layer, String appContext, String description) throws AuthException, SecurityException;
 
-    abstract boolean removeRegistration(String registrationID);
+    public abstract boolean removeRegistration(String registrationID) throws SecurityException;
 
     public static interface RegistrationContext {
 

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigProvider.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigProvider.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigProvider.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/AuthConfigProvider.java
Sun Aug 20 19:25:40 2006
@@ -18,15 +18,16 @@
 package javax.security.auth.message.config;
 
 import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.AuthException;
 
 /**
  * @version $Rev$ $Date$
  */
 public interface AuthConfigProvider {
 
-    ClientAuthConfig getClientAuthConfig(String layer, String appContext, CallbackHandler
handler);
+    ClientAuthConfig getClientAuthConfig(String layer, String appContext, CallbackHandler
handler) throws AuthException, SecurityException;
 
-    ServerAuthConfig getServerAuthConfig(String layer, String appContext, CallbackHandler
handler);
+    ServerAuthConfig getServerAuthConfig(String layer, String appContext, CallbackHandler
handler) throws AuthException, SecurityException;
 
-    void refresh();
+    void refresh() throws AuthException, SecurityException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthConfig.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthConfig.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthConfig.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthConfig.java
Sun Aug 20 19:25:40 2006
@@ -18,6 +18,8 @@
 package javax.security.auth.message.config;
 
 import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+
 import java.util.Map;
 
 /**
@@ -25,5 +27,5 @@
  */
 public interface ClientAuthConfig extends AuthConfig {
 
-    ClientAuthContext getAuthContext(String operation, Subject clientSubject, Map properties);
+    ClientAuthContext getAuthContext(String operation, Subject clientSubject, Map properties)
throws AuthException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthContext.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthContext.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ClientAuthContext.java
Sun Aug 20 19:25:40 2006
@@ -17,8 +17,10 @@
  */
 package javax.security.auth.message.config;
 
+import javax.security.auth.message.ClientAuth;
+
 /**
  * @version $Rev$ $Date$
  */
-public interface ClientAuthContext {
+public interface ClientAuthContext extends ClientAuth {
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ServerAuthConfig.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ServerAuthConfig.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ServerAuthConfig.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/config/ServerAuthConfig.java
Sun Aug 20 19:25:40 2006
@@ -18,6 +18,8 @@
 package javax.security.auth.message.config;
 
 import javax.security.auth.Subject;
+import javax.security.auth.message.AuthException;
+
 import java.util.Map;
 
 /**
@@ -25,5 +27,5 @@
  */
 public interface ServerAuthConfig extends AuthConfig {
 
-    ServerAuthContext getAuthContext(String operation, Subject serviceSubject, Map properties);
+    ServerAuthContext getAuthContext(String operation, Subject serviceSubject, Map properties)
throws AuthException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ClientAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ClientAuthModule.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ClientAuthModule.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ClientAuthModule.java
Sun Aug 20 19:25:40 2006
@@ -17,6 +17,7 @@
  */
 package javax.security.auth.message.module;
 
+import javax.security.auth.message.AuthException;
 import javax.security.auth.message.ClientAuth;
 import javax.security.auth.message.MessagePolicy;
 import javax.security.auth.callback.CallbackHandler;
@@ -27,7 +28,7 @@
  */
 public interface ClientAuthModule extends ClientAuth {
 
-    Class[]     getSupportedMessageTypes();
+    Class[] getSupportedMessageTypes();
 
-    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler
handler, Map options);
+    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler
handler, Map options) throws AuthException;
 }

Modified: geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ServerAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ServerAuthModule.java?rev=433122&r1=433121&r2=433122&view=diff
==============================================================================
--- geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ServerAuthModule.java
(original)
+++ geronimo/specs/branches/geronimo-spec-jaspi/src/main/java/javax/security/auth/message/module/ServerAuthModule.java
Sun Aug 20 19:25:40 2006
@@ -18,6 +18,7 @@
 package javax.security.auth.message.module;
 
 import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.AuthException;
 import javax.security.auth.message.MessagePolicy;
 import javax.security.auth.message.ServerAuth;
 import java.util.Map;
@@ -27,7 +28,7 @@
  */
 public interface ServerAuthModule extends ServerAuth {
 
-    Class[]     getSupportedMessageTypes();
+    Class[] getSupportedMessageTypes();
 
-    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler
handler, Map options);
+    void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler
handler, Map options) throws AuthException;
 }



Mime
View raw message