You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by vt...@apache.org on 2004/06/08 05:38:37 UTC

svn commit: rev 20895 - incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm

Author: vtence
Date: Mon Jun  7 20:38:36 2004
New Revision: 20895

Added:
   incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/PasswordCredential.java
   incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernameCredential.java
Log:
Credentials now strongly typed

Added: incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/PasswordCredential.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/PasswordCredential.java	Mon Jun  7 20:38:36 2004
@@ -0,0 +1,49 @@
+/*
+ *   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.realm;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:vtence@apache.org">Vincent Tence</a>
+ */
+public class PasswordCredential implements Serializable
+{
+    private final String m_password;
+
+    public PasswordCredential( String password )
+    {
+        m_password = password;
+    }
+
+    public boolean equals( Object o )
+    {
+        if ( this == o ) return true;
+        if ( !(o instanceof PasswordCredential) ) return false;
+
+        final PasswordCredential passwordCredential = ( PasswordCredential ) o;
+
+        if ( !m_password.equals( passwordCredential.m_password ) ) return false;
+
+        return true;
+    }
+
+    public int hashCode()
+    {
+        return m_password.hashCode();
+    }
+}

Added: incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernameCredential.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernameCredential.java	Mon Jun  7 20:38:36 2004
@@ -0,0 +1,54 @@
+/*
+ *   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.realm;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:vtence@apache.org">Vincent Tence</a>
+ */
+public class UsernameCredential implements Serializable
+{
+    private final String m_username;
+
+    public UsernameCredential( String name )
+    {
+        m_username = name;
+    }
+
+    public String getUsername()
+    {
+        return m_username;
+    }
+
+    public boolean equals( Object o )
+    {
+        if ( this == o ) return true;
+        if ( !(o instanceof UsernameCredential) ) return false;
+
+        final UsernameCredential usernameCredential = ( UsernameCredential ) o;
+
+        if ( !m_username.equals( usernameCredential.m_username ) ) return false;
+
+        return true;
+    }
+
+    public int hashCode()
+    {
+        return m_username.hashCode();
+    }
+}