public class ADKerberosOperationHandler extends KerberosOperationHandler
KerberosOperationHandler
to created principal in Active DirectoryKERBEROS_ENV_AD_CREATE_ATTRIBUTES_TEMPLATE, KERBEROS_ENV_ADMIN_SERVER_HOST, KERBEROS_ENV_ENCRYPTION_TYPES, KERBEROS_ENV_EXECUTABLE_SEARCH_PATHS, KERBEROS_ENV_KADMIN_PRINCIPAL_NAME, KERBEROS_ENV_KDC_CREATE_ATTRIBUTES, KERBEROS_ENV_KDC_HOSTS, KERBEROS_ENV_LDAP_URL, KERBEROS_ENV_PRINCIPAL_CONTAINER_DN, KERBEROS_ENV_USER_PRINCIPAL_GROUP
Constructor and Description |
---|
ADKerberosOperationHandler() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes and cleans up any resources used by this KerberosOperationHandler
It is expected that this KerberosOperationHandler will not be used after this call.
|
protected LdapContext |
createInitialLdapContext(Properties properties,
Control[] controls)
Helper method to create the LDAP context needed to interact with the Active Directory.
|
protected LdapContext |
createLdapContext()
Helper method to create the LDAP context needed to interact with the Active Directory.
|
Integer |
createPrincipal(String principal,
String password,
boolean service)
Creates a new principal in a previously configured KDC
The implementation is specific to a particular type of KDC.
|
protected SearchControls |
createSearchControls()
Helper method to create the SearchControls instance
|
void |
open(PrincipalKeyCredential administratorCredential,
String realm,
Map<String,String> kerberosConfiguration)
Prepares and creates resources to be used by this KerberosOperationHandler
It is expected that this KerberosOperationHandler will not be used before this call.
|
boolean |
principalExists(String principal,
boolean service)
Test to see if the specified principal exists in a previously configured KDC
The implementation is specific to a particular type of KDC.
|
protected Map<String,Object> |
processCreateTemplate(Map<String,Object> context)
Processes a Velocity template to generate a map of attributes and values to use to create
Active Directory accounts.
|
boolean |
removePrincipal(String principal,
boolean service)
Removes an existing principal in a previously configured KDC
The implementation is specific to a particular type of KDC.
|
Integer |
setPrincipalPassword(String principal,
String password,
boolean service)
Updates the password for an existing principal in a previously configured KDC
The implementation is specific to a particular type of KDC.
|
boolean |
testAdministratorCredentials()
Tests to ensure the connection information and credentials allow for administrative
connectivity to the KDC
|
createDeconstructPrincipal, createKeytab, createKeytabFile, createKeytabFile, createKeytabFile, createKeytabFile, escapeCharacters, executeCommand, executeCommand, executeCommand, getAdministratorCredential, getDefaultRealm, getExecutable, getExecutableSearchPaths, getKeyEncryptionTypes, isOpen, mergeKeytabs, readKeytabFile, setAdministratorCredential, setDefaultRealm, setExecutableSearchPaths, setExecutableSearchPaths, setKeyEncryptionTypes, setOpen, translateEncryptionType, translateEncryptionTypes
public void open(PrincipalKeyCredential administratorCredential, String realm, Map<String,String> kerberosConfiguration) throws KerberosOperationException
open
in class KerberosOperationHandler
administratorCredential
- a PrincipalKeyCredential containing the administrative credential
for the relevant KDCrealm
- a String declaring the default Kerberos realm (or domain)kerberosConfiguration
- a Map of key/value pairs containing data from the kerberos-env configuration setKerberosKDCConnectionException
- if a connection to the KDC cannot be madeKerberosAdminAuthenticationException
- if the administrator credentials fail to authenticateKerberosRealmException
- if the realm does not map to a KDCKerberosOperationException
- if an unexpected error occurredpublic void close() throws KerberosOperationException
close
in class KerberosOperationHandler
KerberosOperationException
public boolean principalExists(String principal, boolean service) throws KerberosOperationException
principalExists
in class KerberosOperationHandler
principal
- a String containing the principal to testservice
- a boolean value indicating whether the principal is for a service or notKerberosOperationException
public Integer createPrincipal(String principal, String password, boolean service) throws KerberosOperationException
createPrincipal
in class KerberosOperationHandler
principal
- a String containing the principal to addpassword
- a String containing the password to use when creating the principalservice
- a boolean value indicating whether the principal is to be created as a service principal or notKerberosPrincipalAlreadyExistsException
- if the principal already existsKerberosOperationException
public Integer setPrincipalPassword(String principal, String password, boolean service) throws KerberosOperationException
setPrincipalPassword
in class KerberosOperationHandler
principal
- a String containing the principal to updatepassword
- a String containing the password to setservice
- a boolean value indicating whether the principal is for a service or notKerberosPrincipalDoesNotExistException
- if the principal does not existKerberosOperationException
public boolean removePrincipal(String principal, boolean service) throws KerberosOperationException
removePrincipal
in class KerberosOperationHandler
principal
- a String containing the principal to removeservice
- a boolean value indicating whether the principal is for a service or notKerberosOperationException
public boolean testAdministratorCredentials() throws KerberosOperationException
KerberosOperationHandler
testAdministratorCredentials
in class KerberosOperationHandler
KerberosOperationException
- if a failure occurs while testing the
administrator credentialsprotected LdapContext createLdapContext() throws KerberosOperationException
KerberosKDCConnectionException
- if a connection to the KDC cannot be madeKerberosAdminAuthenticationException
- if the administrator credentials fail to authenticateKerberosRealmException
- if the realm does not map to a KDCKerberosOperationException
- if an unexpected error occurredprotected LdapContext createInitialLdapContext(Properties properties, Control[] controls) throws NamingException
properties
- environment used to create the initial DirContext.
Null indicates an empty environment.controls
- connection request controls for the initial context.
If null, no connection request controls are used.NamingException
- if a naming exception is encounteredprotected SearchControls createSearchControls()
protected Map<String,Object> processCreateTemplate(Map<String,Object> context) throws KerberosOperationException
context
- a map of properties to pass to the Velocity engineKerberosOperationException
- if an error occurs processing the template.Copyright © 2022 Apache Software Foundation. All rights reserved.