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/11/16 01:29:29 UTC
svn commit: rev 74166 - incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute
Author: vtence
Date: Mon Nov 15 16:29:28 2004
New Revision: 74166
Added:
incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute/AttributePrincipal.java
incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute/RolePrincipal.java
Log:
Out-of-the-box principals implementations
Added: incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute/AttributePrincipal.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute/AttributePrincipal.java Mon Nov 15 16:29:28 2004
@@ -0,0 +1,65 @@
+/*
+ * 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.attribute;
+
+import org.apache.janus.authentication.AbstractPrincipal;
+
+/**
+ * @author <a href="mailto:vtence@apache.org">Vincent Tence</a>
+ */
+public class AttributePrincipal extends AbstractPrincipal
+{
+ private final Object m_value;
+
+ public AttributePrincipal( String name, Object value )
+ {
+ super( name );
+ if ( value == null ) throw new NullPointerException( "value" );
+ m_value = value;
+ }
+
+ public Object getValue()
+ {
+ return m_value;
+ }
+
+ public boolean equals( Object o )
+ {
+ if ( this == o ) return true;
+ if ( !( o instanceof AttributePrincipal ) ) return false;
+ if ( !super.equals( o ) ) return false;
+
+ final AttributePrincipal other = ( AttributePrincipal ) o;
+
+ if ( !m_value.equals( other.m_value ) ) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 29 * result + m_value.hashCode();
+ return result;
+ }
+
+ public String toString()
+ {
+ return "AttributePrincipal: " + super.toString();
+ }
+
+}
Added: incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute/RolePrincipal.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authentication/attribute/RolePrincipal.java Mon Nov 15 16:29:28 2004
@@ -0,0 +1,50 @@
+/*
+ * 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.attribute;
+
+import org.apache.janus.authentication.AbstractPrincipal;
+
+/**
+ * @author <a href="mailto:vtence@apache.org">Vincent Tence</a>
+ */
+public class RolePrincipal extends AbstractPrincipal
+{
+ public RolePrincipal( String name )
+ {
+ super( name );
+ }
+
+ public boolean equals( Object o )
+ {
+ if ( this == o ) return true;
+ if ( !(o instanceof RolePrincipal) ) return false;
+ if ( !super.equals( o ) ) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ public String toString()
+ {
+ return "RolePrincipal: " + super.toString();
+ }
+
+}