directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vte...@apache.org
Subject svn commit: rev 6667 - incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication
Date Sun, 15 Feb 2004 22:41:50 GMT
Author: vtence
Date: Sun Feb 15 14:41:50 2004
New Revision: 6667

Added:
   incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/AuthenticationException.java
   incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/Authenticator.java
   incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/Credential.java
   incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/CredentialCollection.java
Log:
Initial import

Added: incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/AuthenticationException.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/AuthenticationException.java
Sun Feb 15 14:41:50 2004
@@ -0,0 +1,31 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.janus.authentication;
+
+/**
+ * /**
+ * Thrown if there is a problem performing authentication.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ */
+public class AuthenticationException extends Exception
+{
+    public AuthenticationException( String s )
+    {
+        super( s );
+    }
+}

Added: incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/Authenticator.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/Authenticator.java
Sun Feb 15 14:41:50 2004
@@ -0,0 +1,46 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.janus.authentication;
+
+import org.apache.janus.Subject;
+
+/**
+ * <i><strong>Warning:</strong> This is experimental. Don't know yet if
authenticator
+ * may use a single realm or several realms to perform authentication. In the case of several
realms,
+ * each realm will probably support a unique authentication method and the argument to <code>authenticate</code>
+ * will change to a a grouping of credential collections.</i>
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ */
+public interface Authenticator
+{
+    /**
+     * Returns a populated Subject with the principals which represent the
+     * identity of the user as well as any other principal for which permissions may be associated.
+     * <p/>
+     * If the configured realm implementation has <code>GroupSupport</code> then
this
+     * authenticator may choose to add a principal for each group the user is a member of.
+     *
+     * @param credentials A collection of credential objects provided as proof of identity
+     * @return a Subject populated with appropriate principals
+     * @throws AuthenticationException
+     *          thrown if there is a problem during authentication
+     */
+    Subject authenticate( CredentialCollection credentials )
+            throws AuthenticationException;
+}
+

Added: incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/Credential.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/Credential.java
Sun Feb 15 14:41:50 2004
@@ -0,0 +1,84 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.janus.authentication;
+
+import java.io.Serializable;
+
+/**
+ * Class representing a unit of proof of identity.
+ * <p/>
+ * A credential is represented by a type and a value.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ */
+public final class Credential implements Serializable
+{
+    private final String m_type;
+    private final Object m_value;
+
+    /**
+     * Constructs a new credential object with the given type
+     * and value.
+     */
+    public Credential( String type, Object value )
+    {
+        m_type = type;
+        m_value = value;
+    }
+
+    /**
+     * Returns the type of this credential object.
+     */
+    public String getType()
+    {
+        return m_type;
+    }
+
+    /**
+     * Returns the value of this credential object.
+     */
+    public Object getValue()
+    {
+        return m_value;
+    }
+
+    public boolean equals( Object o )
+    {
+        if ( this == o ) return true;
+        if ( !(o instanceof Credential) ) return false;
+
+        final Credential credential = (Credential) o;
+
+        if ( !m_type.equals( credential.m_type ) ) return false;
+        if ( !m_value.equals( credential.m_value ) ) return false;
+
+        return true;
+    }
+
+    public int hashCode()
+    {
+        int result;
+        result = m_type.hashCode();
+        result = 29 * result + m_value.hashCode();
+        return result;
+    }
+
+    public String toString()
+    {
+        return "[Credential: type=" + m_type + ", value=" + m_value + "]";
+    }
+}

Added: incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/CredentialCollection.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/authentication/api/src/java/org/apache/janus/authentication/CredentialCollection.java
Sun Feb 15 14:41:50 2004
@@ -0,0 +1,61 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.janus.authentication;
+
+import java.util.Collection;
+
+/**
+ * A homogeneous collection of credentials. That is, it contains
+ * <code>Credential</code> objects to use with the same authentication method.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ */
+public interface CredentialCollection
+{
+    /**
+     * Returns a subset of the current collection
+     * of credentials composed of all credentials
+     * of the given type.
+     *
+     * @param type of credential to be returned.
+     * @return a new CredentialCollection containing all
+     *         of the Credential objects of the given type.
+     */
+    CredentialCollection get( String type );
+
+    /**
+     * Checks if this credential collection contains credentials.
+     *
+     * @return true is this collection is empty, false if it contains
+     *         at least one credential.
+     */
+    boolean isEmpty();
+
+    /**
+     * Returns a collection of all the credential objects
+     * in the current collection.
+     *
+     * @return a collection of all the Credentials.
+     */
+    Collection elements();
+
+    /**
+     * Returns the authentication method to use with this
+     * CredentialCollection.
+     */
+    String getAuthenticationMethod();
+}
\ No newline at end of file

Mime
View raw message