public class KeyDerivationInterceptor extends BaseInterceptor
Interceptor that creates symmetric Kerberos keys for users. When a
'userPassword' is added or modified, the 'userPassword' and 'krb5PrincipalName'
are used to derive Kerberos keys. If the 'userPassword' is the special keyword
'randomKey', a random key is generated and used as the Kerberos key.| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
KeyDerivationInterceptor.ModifySubContext
A ModifyContext used to store the changes made to the original context.
|
| Modifier and Type | Field and Description |
|---|---|
private org.apache.directory.api.ldap.model.schema.AttributeType |
krb5KeyAT
The krb5Key attribute type
|
private org.apache.directory.api.ldap.model.schema.AttributeType |
krb5KeyVersionNumberAT
The krb5KeyVersionNumber attribute type
|
private org.apache.directory.api.ldap.model.schema.AttributeType |
krb5PrincipalNameAT
The krb5PrincipalName attribute type
|
private static org.slf4j.Logger |
LOG
The log for this class.
|
private static org.slf4j.Logger |
LOG_KRB |
private static java.lang.String |
NAME
The service name.
|
private org.apache.directory.api.ldap.model.schema.AttributeType |
userPasswordAT
The userPassword attribute tType
|
directoryService, dnFactory, PWD_POLICY_STATE_ATTRIBUTE_TYPES, schemaManager| Constructor and Description |
|---|
KeyDerivationInterceptor()
Creates an instance of a KeyDerivationInterceptor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AddOperationContext addContext)
Intercepts the addition of the 'userPassword' and 'krb5PrincipalName' attributes.
|
(package private) void |
deriveKeys(ModifyOperationContext modContext,
KeyDerivationInterceptor.ModifySubContext subContext)
Use the 'userPassword' and 'krb5PrincipalName' attributes to derive Kerberos keys for the principal.
|
private void |
detectPasswordModification(ModifyOperationContext modContext,
KeyDerivationInterceptor.ModifySubContext subContext)
Detect password modification by checking the modify request for the 'userPassword'.
|
private java.util.Map<EncryptionType,EncryptionKey> |
generateKeys(java.lang.String principalName,
java.lang.String userPassword)
Generate the keys.
|
private org.apache.directory.api.ldap.model.entry.Attribute |
getKeyAttribute(java.util.Map<EncryptionType,EncryptionKey> keys)
Create the KRB5_KEY attribute with all the associated keys.
|
void |
init(DirectoryService directoryService)
This method does nothing by default.
|
private void |
lookupPrincipalAttributes(ModifyOperationContext modContext,
KeyDerivationInterceptor.ModifySubContext subContext)
Lookup the principal's attributes that are relevant to executing key derivation.
|
void |
modify(ModifyOperationContext modContext)
Intercept the modification of the 'userPassword' attribute.
|
bind, compare, delete, destroy, getName, getNextInterceptor, getPrincipal, getRootDse, hasEntry, lookup, move, moveAndRename, next, next, next, next, next, next, next, next, next, next, next, next, next, rename, search, unbindprivate static final org.slf4j.Logger LOG
private static final org.slf4j.Logger LOG_KRB
private static final java.lang.String NAME
private org.apache.directory.api.ldap.model.schema.AttributeType krb5KeyAT
private org.apache.directory.api.ldap.model.schema.AttributeType krb5PrincipalNameAT
private org.apache.directory.api.ldap.model.schema.AttributeType krb5KeyVersionNumberAT
private org.apache.directory.api.ldap.model.schema.AttributeType userPasswordAT
public KeyDerivationInterceptor()
public void init(DirectoryService directoryService) throws org.apache.directory.api.ldap.model.exception.LdapException
init in interface Interceptorinit in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void add(AddOperationContext addContext) throws org.apache.directory.api.ldap.model.exception.LdapException
add in interface Interceptoradd in class BaseInterceptoraddContext - The AddOperationContext instanceorg.apache.directory.api.ldap.model.exception.LdapException - If we had some error while processing the Add operationpublic void modify(ModifyOperationContext modContext) throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface Interceptormodify in class BaseInterceptororg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void detectPasswordModification(ModifyOperationContext modContext, KeyDerivationInterceptor.ModifySubContext subContext) throws org.apache.directory.api.ldap.model.exception.LdapException
modContext - The original ModifyContextsubContext - The modification containerorg.apache.directory.api.ldap.model.exception.LdapException - If we get an exceptionprivate void lookupPrincipalAttributes(ModifyOperationContext modContext, KeyDerivationInterceptor.ModifySubContext subContext) throws org.apache.directory.api.ldap.model.exception.LdapException
modContext - The original ModifyContextsubContext - The modification containerorg.apache.directory.api.ldap.model.exception.LdapException - If we get an exceptionvoid deriveKeys(ModifyOperationContext modContext, KeyDerivationInterceptor.ModifySubContext subContext) throws org.apache.directory.api.ldap.model.exception.LdapException
modContext - The original ModifyContextsubContext - The modification containerorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate org.apache.directory.api.ldap.model.entry.Attribute getKeyAttribute(java.util.Map<EncryptionType,EncryptionKey> keys) throws org.apache.directory.api.ldap.model.exception.LdapException
keys - The keys to inject in the attributeorg.apache.directory.api.ldap.model.exception.LdapException - If we had an error while adding a key in the attributeprivate java.util.Map<EncryptionType,EncryptionKey> generateKeys(java.lang.String principalName, java.lang.String userPassword)
principalName - The PrincipaluserPassword - Its password