Author: trustin
Date: Fri Mar 18 07:20:09 2005
New Revision: 158078
URL: http://svn.apache.org/viewcvs?view=rev&rev=158078
Log:
Replaced Invocation with Request and its decendants in jndi.request package.
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/AddRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/DeleteRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetMatchedNameRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetSuffixRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/HasEntryRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/IsSuffixRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListSuffixesRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpWithAttributeIdsRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyManyRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRelativeNameRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveWithNewRelativeNameRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/Request.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/SearchRequest.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authenticatior.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authorizer.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/BaseRequestProcessor.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/NextRequestProcessor.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessor.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessorChain.java
(with props)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessorException.java
(with props)
Removed:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/AuthenticationService.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/BaseInterceptor.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Invocation.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InvocationStateEnum.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ibs/AuthorizationService.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ibs/EventNotificationService.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ibs/ReplicationService.java
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/exception/InterceptorException.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/exception/InterceptorException.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/exception/InterceptorException.java?view=diff&r1=158077&r2=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/exception/InterceptorException.java
(original)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/exception/InterceptorException.java
Fri Mar 18 07:20:09 2005
@@ -86,6 +86,22 @@
super.setRootCause( rootCause );
}
+ /**
+ * Creates an InterceptorException without a message.
+ *
+ * @param interceptor the Interceptor causing the failure
+ * @param invocation the Invocation the Interceptor failed on
+ * @param explanation String explanation of why the Interceptor failed
+ * @param rootCause the root cause of this exception
+ */
+ public InterceptorException( Interceptor interceptor,
+ Invocation invocation,
+ String explanation,
+ Throwable rootCause )
+ {
+ this( interceptor, invocation, explanation );
+ super.setRootCause( rootCause );
+ }
/**
* Gets the invovation object this exception is associated with.
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java?view=diff&r1=158077&r2=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
(original)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
Fri Mar 18 07:20:09 2005
@@ -338,7 +338,7 @@
break;
default:
throw new IllegalStateException( "unexpected invocation
state: "
- + states[ii].getName() );
+ + states[ii].getBaseName() );
}
}
}
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java?view=diff&r1=158077&r2=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
(original)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
Fri Mar 18 07:20:09 2005
@@ -59,6 +59,8 @@
/** The Principal associated with this context */
private LdapPrincipal principal;
+
+ private boolean principalSetOnce;
// ------------------------------------------------------------------------
@@ -161,14 +163,18 @@
/**
- * Package friendly setter to alter the principal. It is very important
- * for security's sake to keep this package friendly and not public.
- *
- * @param principal the directory user principal
+ * Sets the principal of the authenticated user which also happens to own.
+ * This method can be invoked only once to keep this property safe.
*/
- void setPrincipal( LdapPrincipal principal )
+ public synchronized void setPrincipal( LdapPrincipal principal )
{
+ if( principalSetOnce )
+ {
+ throw new IllegalStateException();
+ }
+
this.principal = principal;
+ principalSetOnce = true;
}
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/AddRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/AddRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/AddRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/AddRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,46 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+import javax.naming.directory.Attributes;
+
+public class AddRequest extends Request {
+
+ private final String userProvidedName;
+ private final Name normalizedName;
+ private final Attributes attributes;
+
+ public AddRequest( String userProvidedName, Name normalizedName,
+ Attributes attributes )
+ {
+ if( userProvidedName == null )
+ {
+ throw new NullPointerException( "userProvidedName" );
+ }
+
+ if( normalizedName == null )
+ {
+ throw new NullPointerException( "normalizedName" );
+ }
+
+ if( attributes == null )
+ {
+ throw new NullPointerException( "attributes" );
+ }
+
+ this.userProvidedName = userProvidedName;
+ this.normalizedName = normalizedName;
+ this.attributes = attributes;
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public Name getNormalizedName() {
+ return normalizedName;
+ }
+
+ public String getUserProvidedName() {
+ return userProvidedName;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/AddRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/DeleteRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/DeleteRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/DeleteRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/DeleteRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,22 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class DeleteRequest extends Request {
+
+ private final Name name;
+
+ public DeleteRequest( Name name )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ this.name = name;
+ }
+
+ public Name getName() {
+ return name;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/DeleteRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetMatchedNameRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetMatchedNameRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetMatchedNameRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetMatchedNameRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,28 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class GetMatchedNameRequest extends Request {
+
+ private final Name name;
+ private final boolean normalized;
+
+ public GetMatchedNameRequest( Name name, boolean normalized )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ this.name = name;
+ this.normalized = normalized;
+ }
+
+ public boolean isNormalized() {
+ return normalized;
+ }
+
+ public Name getName() {
+ return name;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetMatchedNameRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetSuffixRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetSuffixRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetSuffixRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetSuffixRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,28 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class GetSuffixRequest extends Request {
+
+ private final Name name;
+ private final boolean normalized;
+
+ public GetSuffixRequest( Name name, boolean normalized )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ this.name = name;
+ this.normalized = normalized;
+ }
+
+ public boolean isNormalized() {
+ return normalized;
+ }
+
+ public Name getName() {
+ return name;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/GetSuffixRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/HasEntryRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/HasEntryRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/HasEntryRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/HasEntryRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,22 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class HasEntryRequest extends Request {
+
+ private final Name name;
+
+ public HasEntryRequest( Name name )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ this.name = name;
+ }
+
+ public Name getName() {
+ return name;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/HasEntryRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/IsSuffixRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/IsSuffixRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/IsSuffixRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/IsSuffixRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,22 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class IsSuffixRequest extends Request {
+
+ private final Name name;
+
+ public IsSuffixRequest( Name name )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ this.name = name;
+ }
+
+ public Name getName() {
+ return name;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/IsSuffixRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,22 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class ListRequest extends Request {
+
+ private final Name baseName;
+
+ public ListRequest( Name baseName )
+ {
+ if( baseName == null )
+ {
+ throw new NullPointerException( "baseName" );
+ }
+
+ this.baseName = baseName;
+ }
+
+ public Name getBaseName() {
+ return baseName;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListSuffixesRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListSuffixesRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListSuffixesRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListSuffixesRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,15 @@
+package org.apache.ldap.server.jndi.request;
+
+public class ListSuffixesRequest extends Request {
+
+ private final boolean normalized;
+
+ public ListSuffixesRequest( boolean normalized )
+ {
+ this.normalized = normalized;
+ }
+
+ public boolean isNormalized() {
+ return normalized;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ListSuffixesRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,22 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class LookUpRequest extends Request {
+
+ private final Name name;
+
+ public LookUpRequest( Name name )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ this.name = name;
+ }
+
+ public Name getName() {
+ return name;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpWithAttributeIdsRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpWithAttributeIdsRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpWithAttributeIdsRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpWithAttributeIdsRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,32 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class LookUpWithAttributeIdsRequest extends Request {
+
+ private final Name name;
+ private final String[] attributeIds;
+
+ public LookUpWithAttributeIdsRequest( Name name, String[] attributeIds )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+ if( attributeIds == null )
+ {
+ throw new NullPointerException( "attributeIds" );
+ }
+
+ this.name = name;
+ this.attributeIds = attributeIds;
+ }
+
+ public Name getName() {
+ return name;
+ }
+
+ public String[] getAttributeIds() {
+ return attributeIds;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/LookUpWithAttributeIdsRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyManyRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyManyRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyManyRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyManyRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,35 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+import javax.naming.directory.ModificationItem;
+
+public class ModifyManyRequest extends Request {
+
+ private final Name name;
+ private final ModificationItem[] modificationItems;
+
+ public ModifyManyRequest( Name name, ModificationItem[] modificationItems )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+ if( modificationItems == null )
+ {
+ throw new NullPointerException( "modificationItems" );
+ }
+
+ this.name = name;
+ this.modificationItems = modificationItems;
+ }
+
+ public Name getName()
+ {
+ return name;
+ }
+
+ public ModificationItem[] getModificationItems()
+ {
+ return modificationItems;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyManyRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRelativeNameRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRelativeNameRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRelativeNameRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRelativeNameRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,43 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class ModifyRelativeNameRequest extends Request {
+
+ private final Name name;
+ private final String newRelativeName;
+ private final boolean deleteOldName;
+
+ public ModifyRelativeNameRequest( Name name, String newRelativeName,
+ boolean deleteOldName )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ if( newRelativeName == null )
+ {
+ throw new NullPointerException( "newRelativeName" );
+ }
+
+ this.name = name;
+ this.newRelativeName = newRelativeName;
+ this.deleteOldName = deleteOldName;
+ }
+
+ public Name getName()
+ {
+ return name;
+ }
+
+ public String getNewRelativeName()
+ {
+ return newRelativeName;
+ }
+
+ public boolean isDeleteOldName()
+ {
+ return deleteOldName;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRelativeNameRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,42 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+import javax.naming.directory.Attributes;
+
+public class ModifyRequest extends Request {
+
+ private final Name name;
+ private final int modOp;
+ private final Attributes attributes;
+
+ public ModifyRequest( Name name, int modOp, Attributes attributes )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+ if( attributes == null )
+ {
+ throw new NullPointerException( "attributes" );
+ }
+
+ this.name = name;
+ this.modOp = modOp;
+ this.attributes = attributes;
+ }
+
+ public Name getName()
+ {
+ return name;
+ }
+
+ public int getModOp()
+ {
+ return modOp;
+ }
+
+ public Attributes getAttributes()
+ {
+ return attributes;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/ModifyRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,35 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class MoveRequest extends Request {
+
+ private final Name name;
+ private final Name newParentName;
+
+ public MoveRequest( Name name, Name newParentName )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+
+ if( newParentName == null )
+ {
+ throw new NullPointerException( "newParentName" );
+ }
+
+ this.name = name;
+ this.newParentName = newParentName;
+ }
+
+ public Name getName()
+ {
+ return name;
+ }
+
+ public Name getNewParentName()
+ {
+ return newParentName;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveWithNewRelativeNameRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveWithNewRelativeNameRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveWithNewRelativeNameRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveWithNewRelativeNameRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,53 @@
+package org.apache.ldap.server.jndi.request;
+
+import javax.naming.Name;
+
+public class MoveWithNewRelativeNameRequest extends Request {
+
+ private final Name name;
+ private final Name newParentName;
+ private final String newRelativeName;
+ private final boolean deleteOldName;
+
+ public MoveWithNewRelativeNameRequest( Name name, Name newParentName,
String newRelativeName,
+ boolean deleteOldName )
+ {
+ if( name == null )
+ {
+ throw new NullPointerException( "name" );
+ }
+ if( newParentName == null )
+ {
+ throw new NullPointerException( "newParentName" );
+ }
+ if( newRelativeName == null )
+ {
+ throw new NullPointerException( "newRelativeName" );
+ }
+
+ this.name = name;
+ this.newParentName = newParentName;
+ this.newRelativeName = newRelativeName;
+ this.deleteOldName = deleteOldName;
+ }
+
+ public Name getName()
+ {
+ return name;
+ }
+
+ public Name getNewParentName()
+ {
+ return newParentName;
+ }
+
+ public String getNewRelativeName()
+ {
+ return newRelativeName;
+ }
+
+ public boolean isDeleteOldName()
+ {
+ return deleteOldName;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/MoveWithNewRelativeNameRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/Request.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/Request.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/Request.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/Request.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,52 @@
+package org.apache.ldap.server.jndi.request;
+
+import java.util.Stack;
+
+public abstract class Request {
+
+ private Object response;
+ private Stack contextStack;
+
+ protected Request()
+ {
+ }
+
+ /**
+ * Returns the response object for this request.
+ */
+ public Object getResponse()
+ {
+ return response;
+ }
+
+ /**
+ * Sets the response object for this request.
+ */
+ public void setResponse( Object response )
+ {
+ this.response = response;
+ }
+
+ /**
+ * Gets the context stack in which this invocation occurs. The context
+ * stack is a stack of LdapContexts.
+ *
+ * @return a stack of LdapContexts in which the invocation occurs
+ */
+ public Stack getContextStack()
+ {
+ return contextStack;
+ }
+
+ /**
+ * Sets the context stack in which this invocation occurs. The context
+ * stack is a stack of LdapContexts.
+ *
+ * @param contextStack a stack of LdapContexts in which the invocation
+ * occurs
+ */
+ public void setContextStack( Stack contextStack )
+ {
+ this.contextStack = contextStack;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/Request.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/SearchRequest.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/SearchRequest.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/SearchRequest.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/SearchRequest.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,62 @@
+package org.apache.ldap.server.jndi.request;
+
+import java.util.Map;
+
+import javax.naming.Name;
+import javax.naming.directory.SearchControls;
+
+import org.apache.ldap.common.filter.ExprNode;
+
+public class SearchRequest extends Request {
+
+ private final Name baseName;
+ private final Map environment;
+ private final ExprNode expressionNode;
+ private final SearchControls searchControls;
+
+ public SearchRequest( Name baseName, Map environment, ExprNode
expressionNode,
+ SearchControls searchControls )
+ {
+ if( baseName == null )
+ {
+ throw new NullPointerException( "baseName" );
+ }
+ if( environment == null )
+ {
+ throw new NullPointerException( "environment" );
+ }
+ if( expressionNode == null )
+ {
+ throw new NullPointerException( "expressionNode" );
+ }
+ if( searchControls == null )
+ {
+ throw new NullPointerException( "searchControls" );
+ }
+
+ this.baseName = baseName;
+ this.environment = environment;
+ this.expressionNode = expressionNode;
+ this.searchControls = searchControls;
+ }
+
+ public Name getBaseName()
+ {
+ return baseName;
+ }
+
+ public Map getEnvironment()
+ {
+ return environment;
+ }
+
+ public ExprNode getExpressionNode()
+ {
+ return expressionNode;
+ }
+
+ public SearchControls getSearchControls()
+ {
+ return searchControls;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/SearchRequest.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authenticatior.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authenticatior.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authenticatior.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authenticatior.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,200 @@
+/*
+ * 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.ldap.server.jndi.request.processor;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.ldap.common.exception.LdapAuthenticationException;
+import
org.apache.ldap.common.exception.LdapAuthenticationNotSupportedException;
+import org.apache.ldap.common.message.ResultCodeEnum;
+import org.apache.ldap.common.util.StringTools;
+import org.apache.ldap.server.auth.AbstractAuthenticator;
+import org.apache.ldap.server.auth.Authenticator;
+import org.apache.ldap.server.auth.LdapPrincipal;
+import org.apache.ldap.server.jndi.ServerContext;
+import org.apache.ldap.server.jndi.ServerLdapContext;
+import org.apache.ldap.server.jndi.request.Request;
+
+/**
+ * A service used to for authenticating users.
+ *
+ * @author <a href="mailto:[email protected]">Apache Directory
Project</a>
+ * @version $Rev$
+ */
+public class Authenticatior implements RequestProcessor
+{
+ /** short for Context.SECURITY_AUTHENTICATION */
+ private static final String AUTH_TYPE = Context.SECURITY_AUTHENTICATION;
+
+ /** short for Context.SECURITY_CREDENTIALS */
+ private static final String CREDS = Context.SECURITY_CREDENTIALS;
+
+ /** authenticators **/
+ public Map authenticators = new LinkedHashMap();
+
+
+ /**
+ * Creates an authentication service interceptor.
+ */
+ public Authenticatior()
+ {
+ }
+
+ /**
+ * Registers an Authenticator with this AuthenticatorService. Called by
each
+ * Authenticator implementation after it has started to register for
+ * authentication operation calls.
+ *
+ * @param authenticator Authenticator component to register with this
+ * AuthenticatorService.
+ */
+ public void register( AbstractAuthenticator authenticator )
+ {
+ Collection authenticatorList = getAuthenticators(
authenticator.getType() );
+ if ( authenticatorList == null )
+ {
+ authenticatorList = new ArrayList();
+ authenticators.put( authenticator.getType(), authenticatorList );
+ }
+ authenticatorList.add( authenticator );
+ }
+
+ /**
+ * Unregisters an Authenticator with this AuthenticatorService. Called
for each
+ * registered Authenticator right before it is to be stopped. This
prevents
+ * protocol server requests from reaching the Backend and effectively puts
+ * the ContextPartition's naming context offline.
+ *
+ * @param authenticator Authenticator component to unregister with this
+ * AuthenticatorService.
+ */
+ public void unregister( Authenticator authenticator )
+ {
+ Collection authenticatorList = getAuthenticators(
authenticator.getType() );
+ if ( authenticatorList == null )
+ {
+ return;
+ }
+ authenticatorList.remove( authenticator );
+ }
+
+ /**
+ * Gets the authenticators with a specific type.
+ *
+ * @param type the authentication type
+ * @return the authenticators with the specified type
+ */
+ public Collection getAuthenticators( String type )
+ {
+ return (Collection)authenticators.get( type );
+ }
+
+ public void init( Properties config )
+ {
+ }
+
+ public void destroy()
+ {
+ }
+
+ public void process( NextRequestProcessor nextProcessor, Request request )
throws NamingException
+ {
+ // check if we are already authenticated and if so we return making
+ // sure first that the credentials are not exposed within context
+ ServerContext ctx = ( ServerLdapContext )
request.getContextStack().peek();
+ if ( ctx.getPrincipal() != null )
+ {
+ if ( ctx.getEnvironment().containsKey( CREDS ) )
+ {
+ ctx.removeFromEnvironment( CREDS );
+ }
+
+ nextProcessor.process(request);
+ }
+
+ String authList = ( String ) ctx.getEnvironment().get( AUTH_TYPE );
+
+ if ( authList == null )
+ {
+ if ( ctx.getEnvironment().containsKey( CREDS ) )
+ {
+ // authentication type is simple here
+ authList = "simple";
+ }
+ else
+ {
+ // authentication type is anonymous
+ authList = "none";
+ }
+
+ }
+
+ authList = StringTools.deepTrim( authList );
+ String[] auth = authList.split( " " );
+
+ Collection authenticators = null;
+
+ // pick the first matching authenticator type
+ for ( int i=0; i<auth.length; i++)
+ {
+ authenticators = getAuthenticators( auth[i] );
+ if ( authenticators != null ) break;
+ }
+
+ if ( authenticators == null )
+ {
+ ctx.getEnvironment(); // shut's up idea's yellow light
+ ResultCodeEnum rc = ResultCodeEnum.AUTHMETHODNOTSUPPORTED;
+ throw new LdapAuthenticationNotSupportedException( rc );
+ }
+
+ // try each authenticators
+ for ( Iterator i = authenticators.iterator(); i.hasNext(); )
+ {
+ try
+ {
+ Authenticator authenticator = ( Authenticator ) i.next();
+
+ // perform the authentication
+ LdapPrincipal authorizationId = authenticator.authenticate(
ctx );
+
+ // authentication was successful
+ ctx.setPrincipal( authorizationId );
+
+ // remove creds so there is no security risk
+ ctx.removeFromEnvironment( CREDS );
+ nextProcessor.process(request);
+ return;
+ }
+ catch ( LdapAuthenticationException e )
+ {
+ // authentication failed, try the next authenticator
+ }
+ }
+
+ throw new LdapAuthenticationException();
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authenticatior.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authorizer.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authorizer.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authorizer.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authorizer.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,430 @@
+/*
+ * 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.ldap.server.jndi.request.processor;
+
+
+import java.util.Properties;
+
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.ldap.common.exception.LdapNoPermissionException;
+import org.apache.ldap.common.name.DnParser;
+import org.apache.ldap.common.name.NameComponentNormalizer;
+import org.apache.ldap.server.SystemPartition;
+import org.apache.ldap.server.db.ResultFilteringEnumeration;
+import org.apache.ldap.server.db.SearchResultFilter;
+import org.apache.ldap.server.jndi.ServerContext;
+import org.apache.ldap.server.jndi.ibs.FilterService;
+import org.apache.ldap.server.jndi.request.DeleteRequest;
+import org.apache.ldap.server.jndi.request.HasEntryRequest;
+import org.apache.ldap.server.jndi.request.LookUpRequest;
+import org.apache.ldap.server.jndi.request.LookUpWithAttributeIdsRequest;
+import org.apache.ldap.server.jndi.request.ModifyManyRequest;
+import org.apache.ldap.server.jndi.request.ModifyRelativeNameRequest;
+import org.apache.ldap.server.jndi.request.ModifyRequest;
+import org.apache.ldap.server.jndi.request.MoveRequest;
+import org.apache.ldap.server.jndi.request.MoveWithNewRelativeNameRequest;
+import org.apache.ldap.server.jndi.request.Request;
+import org.apache.ldap.server.jndi.request.SearchRequest;
+
+
+/**
+ * A service used for applying access controls to backing store operations.
+ *
+ * @author <a href="mailto:[email protected]">Apache Directory
Project</a>
+ * @version $Rev$
+ */
+public class Authorizer extends BaseRequestProcessor
+{
+ /** the administrator's distinguished [EMAIL PROTECTED] Name} */
+ private static final Name ADMIN_DN = SystemPartition.getAdminDn();
+ /** the base distinguished [EMAIL PROTECTED] Name} for all users */
+ private static final Name USER_BASE_DN = SystemPartition.getUsersBaseDn();
+ /** the base distinguished [EMAIL PROTECTED] Name} for all groups */
+ private static final Name GROUP_BASE_DN =
SystemPartition.getGroupsBaseDn();
+
+ /** the name parser used by this service */
+ private final DnParser dnParser;
+
+
+ /**
+ * Creates an authorization service interceptor.
+ *
+ * @param normalizer a schema enabled name component normalizer
+ * @param filterService a [EMAIL PROTECTED] FilterService} to register
filters with
+ */
+ public Authorizer( NameComponentNormalizer normalizer )
+ throws NamingException
+ {
+ this.dnParser = new DnParser( normalizer );
+ }
+
+ public void init( Properties config )
+ {
+ }
+
+ public void destroy()
+ {
+ }
+
+ // Note:
+ // Lookup, search and list operations need to be handled using a filter
+ // and so we need access to the filter service.
+
+ protected void process( NextRequestProcessor nextProcessor, DeleteRequest
request ) throws NamingException
+ {
+ Name name = request.getName();
+ Name principalDn = getPrincipal( request ).getDn();
+
+ if ( name.toString().equals( "" ) )
+ {
+ String msg = "The rootDSE cannot be deleted!";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( name == ADMIN_DN || name.equals( ADMIN_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to delete the admin account.";
+ msg += " No one not even the admin can delete this account!";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( name.size() > 2 && name.startsWith( USER_BASE_DN )
+ && ! principalDn.equals( ADMIN_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to delete the user account: ";
+ msg += name + ". Only the admin can delete user accounts.";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( name.size() > 2 && name.startsWith( GROUP_BASE_DN )
+ && ! principalDn.equals( ADMIN_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to delete the group entry: ";
+ msg += name + ". Only the admin can delete groups.";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ nextProcessor.process( request );
+ }
+
+
+ /**
+ * Note that we do nothing here. First because this is not an externally
+ * exposed function via the JNDI interfaces. It is used internally by the
+ * provider for optimization purposes so there is no reason for us to start
+ * to constrain it.
+ *
+ * @see org.apache.ldap.server.jndi.BaseInterceptor#hasEntry(Name)
+ */
+ protected void process( NextRequestProcessor nextProcessor,
HasEntryRequest request ) throws NamingException
+ {
+ super.process( nextProcessor, request );
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Entry Modification Operations
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * This policy needs to be really tight too because some attributes may
+ * take part in giving the user permissions to protected resources. We
+ * do not want users to self access these resources. As far as we're
+ * concerned no one but the admin needs access.
+ *
+ * @see BaseInterceptor#modify(Name, int, Attributes)
+ */
+ protected void process( NextRequestProcessor nextProcessor, ModifyRequest
request ) throws NamingException
+ {
+ protectModifyAlterations( request, request.getName() );
+ nextProcessor.process( request );
+ }
+
+
+ /**
+ * This policy needs to be really tight too because some attributes may
+ * take part in giving the user permissions to protected resources. We
+ * do not want users to self access these resources. As far as we're
+ * concerned no one but the admin needs access.
+ *
+ * @see BaseInterceptor#modify(Name, ModificationItem[])
+ */
+ protected void process( NextRequestProcessor nextProcessor,
ModifyManyRequest request ) throws NamingException
+ {
+ protectModifyAlterations( request, request.getName() );
+ nextProcessor.process( request );
+ }
+
+
+ private void protectModifyAlterations( Request request, Name dn ) throws
LdapNoPermissionException
+ {
+ Name principalDn = getPrincipal( request ).getDn();
+
+ if ( dn.toString().equals( "" ) )
+ {
+ String msg = "The rootDSE cannot be modified!";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( ! principalDn.equals( ADMIN_DN ) )
+ {
+ if ( dn == ADMIN_DN || dn.equals( ADMIN_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to modify the admin
account.";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn.size() > 2 && dn.startsWith( USER_BASE_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to modify the account of
the";
+ msg += " user " + dn + ".\nEven the owner of an account
cannot";
+ msg += " modify it.\nUser accounts can only be modified by
the";
+ msg += " administrator.";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn.size() > 2 && dn.startsWith( GROUP_BASE_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to modify the group entry ";
+ msg += dn + ".\nGroups can only be modified by the admin.";
+ throw new LdapNoPermissionException( msg );
+ }
+ }
+ }
+
+
+ // ------------------------------------------------------------------------
+ // DN altering operations are a no no for any user entry. Basically here
+ // are the rules of conduct to follow:
+ //
+ // o No user should have the ability to move or rename their entry
+ // o Only the administrator can move or rename non-admin user entries
+ // o The administrator entry cannot be moved or renamed by anyone
+ // ------------------------------------------------------------------------
+
+
+ protected void process( NextRequestProcessor nextProcessor,
ModifyRelativeNameRequest request ) throws NamingException
+ {
+ protectDnAlterations( request, request.getName() );
+ nextProcessor.process( request );
+ }
+
+
+ protected void process( NextRequestProcessor nextProcessor, MoveRequest
request ) throws NamingException
+ {
+ protectDnAlterations( request, request.getName() );
+ nextProcessor.process( request );
+ }
+
+
+ protected void process( NextRequestProcessor nextProcessor,
MoveWithNewRelativeNameRequest request ) throws NamingException
+ {
+ protectDnAlterations( request, request.getName() );
+ nextProcessor.process( request );
+ }
+
+
+ private void protectDnAlterations( Request request, Name dn ) throws
LdapNoPermissionException
+ {
+ Name principalDn = getPrincipal( request ).getDn();
+
+ if ( dn.toString().equals( "" ) )
+ {
+ String msg = "The rootDSE cannot be moved or renamed!";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn == ADMIN_DN || dn.equals( ADMIN_DN ) )
+ {
+ String msg = "User '" + principalDn;
+ msg += "' does not have permission to move or rename the admin";
+ msg += " account. No one not even the admin can move or";
+ msg += " rename " + dn + "!";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn.size() > 2 && dn.startsWith( USER_BASE_DN ) && !
principalDn.equals( ADMIN_DN ) )
+ {
+ String msg = "User '" + principalDn;
+ msg += "' does not have permission to move or rename the user";
+ msg += " account: " + dn + ". Only the admin can move or";
+ msg += " rename user accounts.";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn.size() > 2 && dn.startsWith( GROUP_BASE_DN ) && !
principalDn.equals( ADMIN_DN ) )
+ {
+ String msg = "User " + principalDn;
+ msg += " does not have permission to move or rename the group
entry ";
+ msg += dn + ".\nGroups can only be moved or renamed by the admin.";
+ throw new LdapNoPermissionException( msg );
+ }
+ }
+
+ protected void process(NextRequestProcessor nextProcessor, LookUpRequest
request) throws NamingException {
+ super.process(nextProcessor, request);
+
+ Attributes attributes = ( Attributes ) request.getResponse();
+ if( attributes == null )
+ {
+ return;
+ }
+
+ Attributes retval = ( Attributes ) attributes.clone();
+ LdapContext ctx = ( LdapContext ) request.getContextStack().peek();
+ protectLookUp( ctx, request.getName() );
+ request.setResponse( retval );
+ }
+
+ protected void process(NextRequestProcessor nextProcessor,
LookUpWithAttributeIdsRequest request) throws NamingException {
+ super.process(nextProcessor, request);
+
+ Attributes attributes = ( Attributes ) request.getResponse();
+ if( attributes == null )
+ {
+ return;
+ }
+
+ Attributes retval = ( Attributes ) attributes.clone();
+ LdapContext ctx = ( LdapContext ) request.getContextStack().peek();
+ protectLookUp( ctx, request.getName() );
+ request.setResponse( retval );
+ }
+
+ private void protectLookUp( LdapContext ctx, Name dn ) throws
NamingException
+ {
+ Name principalDn = ( ( ServerContext ) ctx ).getPrincipal().getDn();
+
+ if ( ! principalDn.equals( ADMIN_DN ) )
+ {
+ if ( dn.size() > 2 && dn.startsWith( USER_BASE_DN ) )
+ {
+ // allow for self reads
+ if ( dn.toString().equals( principalDn.toString() ) )
+ {
+ return;
+ }
+
+ String msg = "Access to user account '" + dn + "' not
permitted";
+ msg += " for user '" + principalDn + "'. Only the admin can";
+ msg += " access user account information";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn.size() > 2 && dn.startsWith( GROUP_BASE_DN ) )
+ {
+ // allow for self reads
+ if ( dn.toString().equals( principalDn.toString() ) )
+ {
+ return;
+ }
+
+ String msg = "Access to group '" + dn + "' not permitted";
+ msg += " for user '" + principalDn + "'. Only the admin can";
+ msg += " access group information";
+ throw new LdapNoPermissionException( msg );
+ }
+
+ if ( dn.equals( ADMIN_DN ) )
+ {
+ // allow for self reads
+ if ( dn.toString().equals( principalDn.toString() ) )
+ {
+ return;
+ }
+
+ String msg = "Access to admin account not permitted for user
'";
+ msg += principalDn + "'. Only the admin can";
+ msg += " access admin account information";
+ throw new LdapNoPermissionException( msg );
+ }
+ }
+ }
+
+ protected void process(NextRequestProcessor nextProcessor, SearchRequest
request) throws NamingException {
+ super.process(nextProcessor, request);
+
+ SearchControls searchControls = request.getSearchControls();
+ if ( searchControls.getReturningAttributes() != null )
+ {
+ return;
+ }
+
+ NamingEnumeration e ;
+ ResultFilteringEnumeration retval;
+ LdapContext ctx = ( LdapContext ) request.getContextStack().peek();
+ e = ( NamingEnumeration ) request.getResponse();
+ retval = new ResultFilteringEnumeration( e, searchControls, ctx,
+ new SearchResultFilter()
+ {
+ public boolean accept( LdapContext ctx, SearchResult result,
+ SearchControls controls )
+ throws NamingException
+ {
+ return Authorizer.this.isSearchable( ctx, result, controls
);
+ }
+ } );
+
+ request.setResponse( retval );
+ }
+
+ private boolean isSearchable( LdapContext ctx, SearchResult result,
SearchControls controls )
+ throws NamingException
+ {
+ Name dn;
+
+ synchronized( dnParser )
+ {
+ dn = dnParser.parse( result.getName() );
+ }
+
+ Name principalDn = ( ( ServerContext ) ctx ).getPrincipal().getDn();
+ if ( ! principalDn.equals( ADMIN_DN ) )
+ {
+ if ( dn.size() > 2 )
+ {
+ if ( dn.startsWith( USER_BASE_DN ) || dn.startsWith(
GROUP_BASE_DN ) )
+ {
+ return false;
+ }
+ }
+
+ if ( dn.equals( ADMIN_DN ) )
+ {
+ return false;
+ }
+
+ }
+
+ return true;
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/Authorizer.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/BaseRequestProcessor.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/BaseRequestProcessor.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/BaseRequestProcessor.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/BaseRequestProcessor.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,265 @@
+/*
+ * 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.ldap.server.jndi.request.processor;
+
+
+import javax.naming.NamingException;
+
+import org.apache.ldap.server.auth.LdapPrincipal;
+import org.apache.ldap.server.jndi.ServerContext;
+import org.apache.ldap.server.jndi.request.AddRequest;
+import org.apache.ldap.server.jndi.request.DeleteRequest;
+import org.apache.ldap.server.jndi.request.GetMatchedNameRequest;
+import org.apache.ldap.server.jndi.request.GetSuffixRequest;
+import org.apache.ldap.server.jndi.request.HasEntryRequest;
+import org.apache.ldap.server.jndi.request.IsSuffixRequest;
+import org.apache.ldap.server.jndi.request.ListRequest;
+import org.apache.ldap.server.jndi.request.ListSuffixesRequest;
+import org.apache.ldap.server.jndi.request.LookUpRequest;
+import org.apache.ldap.server.jndi.request.LookUpWithAttributeIdsRequest;
+import org.apache.ldap.server.jndi.request.ModifyManyRequest;
+import org.apache.ldap.server.jndi.request.ModifyRelativeNameRequest;
+import org.apache.ldap.server.jndi.request.ModifyRequest;
+import org.apache.ldap.server.jndi.request.MoveRequest;
+import org.apache.ldap.server.jndi.request.MoveWithNewRelativeNameRequest;
+import org.apache.ldap.server.jndi.request.Request;
+import org.apache.ldap.server.jndi.request.SearchRequest;
+
+
+/**
+ * An interceptor base class which delegates handling of specific Invocations
+ * to member methods within this Interceptor. These handler methods are
+ * analogous to the methods assocated with the Invocation. They have the same
+ * name and arguments as do the method associated with the Invocation. The
+ * analog member methods simply serve as a clean way to handle interception
+ * without having to cast parameter Objects or recode this huge switch
statement
+ * for each concrete Interceptor implementation.
+ *
+ * A ThreadLocal is used by all BaseInterceptors to associate the current
+ * Thread of execution with an Invocation object. This is done to optimize
+ * the use of a single thread local for all instances of the BaseInterceptor
+ * class. It also removes the need for the invoke() method implementation to
+ * have to set and [un]set the thread local Invocation on each invoke call of
+ * every BaseInterceptor instance.
+ *
+ * The question then arrises, "Why do we need the ThreadLocal?" Well why pass
+ * around the Invocation object to all analog methods. Plus we use member
+ * methods rather than static methods to access thread locals and make the
+ * analogs appear cleaner matching their respective invocation methods.
+ *
+ * @author <a href="mailto:[email protected]">Apache Directory
Project</a>
+ * @version $Rev$
+ */
+public abstract class BaseRequestProcessor implements RequestProcessor
+{
+ /**
+ * Gets the request's current context's Principal.
+ *
+ * @return the principal making the call
+ */
+ public static LdapPrincipal getPrincipal( Request request )
+ {
+ ServerContext ctx = ( ServerContext ) request.getContextStack().peek();
+ return ctx.getPrincipal();
+ }
+
+ protected BaseRequestProcessor()
+ {
+ }
+
+ // ------------------------------------------------------------------------
+ // Interceptor's Invoke Method
+ // ------------------------------------------------------------------------
+
+ /**
+ * Uses a switch on the invocation method type to call the respective
member
+ * analog method that does the work of the Interceptor for that Invocation
+ * method.
+ */
+ public void process( NextRequestProcessor nextProcessor, Request request )
+ throws NamingException
+ {
+ if( request instanceof AddRequest )
+ {
+ process( nextProcessor, ( AddRequest ) request );
+ }
+ else if( request instanceof DeleteRequest )
+ {
+ process( nextProcessor, ( DeleteRequest ) request );
+ }
+ else if( request instanceof GetMatchedNameRequest )
+ {
+ process( nextProcessor, ( GetMatchedNameRequest ) request );
+ }
+ else if( request instanceof GetSuffixRequest )
+ {
+ process( nextProcessor, ( GetSuffixRequest ) request );
+ }
+ else if( request instanceof HasEntryRequest )
+ {
+ process( nextProcessor, ( HasEntryRequest ) request );
+ }
+ else if( request instanceof IsSuffixRequest )
+ {
+ process( nextProcessor, ( IsSuffixRequest ) request );
+ }
+ else if( request instanceof ListRequest )
+ {
+ process( nextProcessor, ( ListRequest ) request );
+ }
+ else if( request instanceof ListSuffixesRequest )
+ {
+ process( nextProcessor, ( ListSuffixesRequest ) request );
+ }
+ else if( request instanceof LookUpRequest )
+ {
+ process( nextProcessor, ( LookUpRequest ) request );
+ }
+ else if( request instanceof LookUpWithAttributeIdsRequest )
+ {
+ process( nextProcessor, ( LookUpWithAttributeIdsRequest ) request
);
+ }
+ else if( request instanceof ModifyRequest )
+ {
+ process( nextProcessor, ( ModifyRequest ) request );
+ }
+ else if( request instanceof ModifyManyRequest )
+ {
+ process( nextProcessor, ( ModifyManyRequest ) request );
+ }
+ else if( request instanceof ModifyRelativeNameRequest )
+ {
+ process( nextProcessor, ( ModifyRelativeNameRequest ) request );
+ }
+ else if( request instanceof MoveRequest )
+ {
+ process( nextProcessor, ( MoveRequest ) request );
+ }
+ else if( request instanceof MoveWithNewRelativeNameRequest )
+ {
+ process( nextProcessor, ( MoveWithNewRelativeNameRequest ) request
);
+ }
+ else if( request instanceof SearchRequest )
+ {
+ process( nextProcessor, ( SearchRequest ) request );
+ }
+ else {
+ throw new IllegalArgumentException(
+ "Unknown request type: " + request.getClass() );
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Invocation Analogs
+ // ------------------------------------------------------------------------
+
+ protected void process( NextRequestProcessor nextProcessor, AddRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor, DeleteRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
GetMatchedNameRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
GetSuffixRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
HasEntryRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
IsSuffixRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor, ListRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
ListSuffixesRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor, LookUpRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
LookUpWithAttributeIdsRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor, ModifyRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
ModifyManyRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
ModifyRelativeNameRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor, MoveRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor,
MoveWithNewRelativeNameRequest request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+
+ protected void process( NextRequestProcessor nextProcessor, SearchRequest
request )
+ throws NamingException
+ {
+ nextProcessor.process( request );
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/BaseRequestProcessor.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/NextRequestProcessor.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/NextRequestProcessor.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/NextRequestProcessor.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/NextRequestProcessor.java
Fri Mar 18 07:20:09 2005
@@ -0,0 +1,9 @@
+package org.apache.ldap.server.jndi.request.processor;
+
+import javax.naming.NamingException;
+
+import org.apache.ldap.server.jndi.request.Request;
+
+public interface NextRequestProcessor {
+ void process( Request request ) throws NamingException;
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/NextRequestProcessor.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessor.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessor.java?view=auto&rev=158078
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessor.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessor.java
Fri Mar 18 07:20:09 2005
@@ -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.ldap.server.jndi.request.processor;
+
+import java.util.Properties;
+
+import javax.naming.NamingException;
+
+import org.apache.ldap.server.jndi.request.Request;
+
+/**
+ * Processes or filters any directory operations. You can intercept the
+ * [EMAIL PROTECTED] Invocation}s and perform 'before', 'after', 'around' any
any other
+ * filtering operations.
+ *
+ * @author The Apache Directory Project ([email protected])
+ * @author Trustin Lee ([EMAIL PROTECTED])
+ * @version $Rev$, $Date$
+ */
+public interface RequestProcessor
+{
+ /**
+ * Intializes this interceptor. This is invoked by directory service
+ * provider when this intercepter is loaded into interceptor chain.
+ *
+ * @param config the configuration properties for this interceptor
+ * @throws NamingException if failed to initialize this interceptor
+ */
+ void init( Properties config ) throws NamingException;
+
+ /**
+ * Deinitialized this interceptor. This is invoked by directory service
+ * provider when this intercepter is unloaded from interceptor chain.
+ */
+ void destroy();
+
+ /**
+ * Process a particular invocation. You can pass control to
+ * <code>nextInterceptor</code> by invoking [EMAIL PROTECTED]
#invoke(RequestProcessor, Invocation)}.
+ *
+ * @param nextProcessor the next processor in the processor chain
+ * @param invocation the invocation to process
+ * @throws NamingException on failures while handling the invocation
+ */
+ void process( NextRequestProcessor nextProcessor, Request request )
+ throws NamingException;
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/request/processor/RequestProcessor.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision