title: 1.4 - Interceptors navPrev: 1.3-directory-service.html navPrevText: 1.3 - DirectoryService navUp: 1-architecture.html navUpText: 1 - Architecture navNext: 1.5-backend.html navNextText: 1.5 - Backend

1.4 - Interceptors

Interceptors are functional layers inside the DirectoryService. Each one of them are responsible for a specific task. They are ordered, and this order is not to be changed.

Each operation received by the DirectoryService will be processed by various interceptors, one after the other, down to the backend, and again when the result comes back to the caller. An interceptor can call the next interceptor, whcih will be determinated by the position it has in the chain of interceptors, or simply return. Note that calling the next interceptor does not require that you know which one will be called.

Some Interceptors can be disabled, some other can be enabled. It's also possible to add some new one.

All in all, they will handle operations from a specific functional aspect.

Handled operations

Each Interceptor handles a subset of the possible operations, among those listed in the following table :

OperationDescription
addAdds an entry in the backend
bindBinds on the DirectoryService
compareCompares the elements with the associated entry in the backend
deleteDeletes the entry
getRooDSEGets back the RootDSE entry
hasEntryTells if an entry exists
lookupFetches an entry
modifyModifies an entry
moveMoves an entry
moveAndRenameMoves and renames an entry
renameRenames an entry
searchSearches for entries
unbindUnbinds from the DirectoryService

It is important to understand that each operation will go through each Interceptor declared to handle the operation, down to the backend.

Existing interceptors

The following interceptors are already present in the server, even if they are not enabled. In this table, we list all the operations each interceptor is handling, and if the interceptor is enabled by default or not :

InterceptorEnabledaddbndcmpdelDSEhaslkpmodmovm&rrenseaubd
AciAuthorizationInterceptoryesX-XX-XXXXXXX-
AdministrativePointInterceptoryesX--X---XXXX?-
AuthenticationInterceptoryesXXXXXXXXXXXXX
ChangeLogInterceptoryesX--X---XXXX-
CollectiveAttributeInterceptoryesX-----XX---X-
DefaultAuthorizationInterceptoryes---X--XXXXXX-
DelayInducingInterceptorno-----------X-
EventInterceptoryesX--X---XXXX--
ExceptionInterceptoryesX--X---XXXX--
JournalInterceptoryesX--X---XXXX--
KeyDerivationInterceptornoX------X-----
NormalizationInterceptoryesXXXX-XXXXXXX-
NumberIncrementInterceptoryesX------------
OperationalAttributeInterceptoryesX--X--XXXXXX-
PasswordHashingInterceptornoX------X-----
CryptPasswordHashingInterceptornoX------X-----
Md5PasswordHashingInterceptornoX------X-----
Pkcs5s2PasswordHashingInterceptornoX------X-----
Sha256PasswordHashingInterceptornoX------X-----
Sha384PasswordHashingInterceptornoX------X-----
Sha512PasswordHashingInterceptornoX------X-----
ShaPasswordHashingInterceptornoX------X-----
Smd5PasswordHashingInterceptornoX------X-----
Ssha256PasswordHashingInterceptornoX------X-----
Ssha384PasswordHashingInterceptornoX------X-----
Ssha512PasswordHashingInterceptornoX------X-----
SshaPasswordHashingInterceptornoX------X-----
ReferralInterceptoryesX--X---XXXX--
SchemaInterceptoryesX-X---XX-?XX-
SubentryInterceptoryesX--X--?XXXXX-
TimerInterceptornoXXXXXXXXXXXXX
TriggerInterceptoryesX--X---XXXX--

The operations that are available are the operations for which we have some implementation in the interceptor class. For instance, the JournalInterceptor class implement the add, delete, modify, move, moveAndRename and rename methods.

Interceptors order

As we already said, the Interceptors order is significant : why would we proceed an Add operation through all the Interceptors if the user is simply denied the right to add an entry by the AciAuthorizationInterceptor ?

Currently, the following order is enforced :

OrderInterceptor
1NormalizationInterceptor
2AuthenticationInterceptor
3ReferralInterceptor
4AciAuthorizationInterceptor
5DefaultAuthorizationInterceptor
6AdministrativePointInterceptor
7ExceptionInterceptor
8SchemaInterceptor
9OperationalAttributeInterceptor
10SubentryInterceptor
11EventInterceptor
12TriggerInterceptor
13ChangeLogInterceptor
14JournalInterceptor

Example

Let's consider the search operation. It will be processed successively by the following Interceptors, as it can be deduced by the two previous tables :

  • NormalizationInterceptor
  • AuthenticationInterceptor
  • AciAuthorizationInterceptor
  • DefaultAuthorizationInterceptor
  • SchemaInterceptor
  • OperationalAttributeInterceptor
  • SubentryInterceptor

We can do the same exercise for each operation.

Processing

Basically, an Interceptor receives a request for an operation, does some pre-processing, calls the next Interceptor in the chain, does some post-processing, and returns a result.

Calling the next Interceptor is as simple as calling the next(OperationContext) method, which will compute the right Interceptor.

The pre-processing and post-processing are standard Java code, there is nothing special there.

Each operation is passed into an instance of a specific OperationContext, which contains all what is needed about the operation and the environment.