public class CreatePrincipalsServerAction extends KerberosServerAction
KerberosServerAction.processIdentity(ResolvedKerberosPrincipal, KerberosOperationHandler, Map, boolean, Map)
is invoked attempting the creation of the relevant principal.Modifier and Type | Class and Description |
---|---|
static class |
CreatePrincipalsServerAction.CreatePrincipalResult
CreatePrincipalResult holds values created as a result of creating a principal in a KDC.
|
KerberosServerAction.KerberosCommandParameters, KerberosServerAction.OperationType
AUTHENTICATED_USER_NAME, DATA_DIRECTORY, DATA_DIRECTORY_PREFIX, DEFAULT_REALM, HOST_FILTER, IDENTITY_FILTER, INCLUDE_AMBARI_IDENTITY, KDC_TYPE, KEYTAB_CONTENT_BASE64, OPERATION_TYPE, PRECONFIGURE_SERVICES, SERVICE_COMPONENT_FILTER, UPDATE_CONFIGURATION_NOTE, UPDATE_CONFIGURATION_POLICY
actionLog, gson
ACTION_NAME, ACTION_USER_NAME, DEFAULT_LONG_RUNNING_TASK_TIMEOUT_SECONDS, WRAPPED_CLASS_NAME
Constructor and Description |
---|
CreatePrincipalsServerAction() |
Modifier and Type | Method and Description |
---|---|
CreatePrincipalsServerAction.CreatePrincipalResult |
createPrincipal(String principal,
boolean isServicePrincipal,
Map<String,String> kerberosConfiguration,
KerberosOperationHandler kerberosOperationHandler,
boolean regenerateKeytabs,
ActionLog actionLog)
Creates a principal in the relevant KDC
|
CommandReport |
execute(ConcurrentMap<String,Object> requestSharedDataContext)
Called to execute this action.
|
protected CommandReport |
processIdentity(ResolvedKerberosPrincipal resolvedPrincipal,
KerberosOperationHandler operationHandler,
Map<String,String> kerberosConfiguration,
boolean includedInFilter,
Map<String,Object> requestSharedDataContext)
For each identity, generate a unique password, and create a new or update an existing principal in
an assumed to be configured KDC.
|
ambariServerHostID, deleteDataDirectory, getCluster, getClusterName, getClusters, getCommandParameterValue, getCommandPreconfigureType, getConfigurationProperties, getDataDirectoryPath, getDataDirectoryPath, getDefaultRealm, getHostFilter, getIdentityFilter, getKDCType, getOperationType, getPrincipalKeyNumberMap, getPrincipalPasswordMap, getServiceComponentFilter, getUpdateConfigurationPolicy, hasHostFilters, processIdentities, pruneServiceFilter, setPrincipalPasswordMap
auditLog, createCommandReport, createCompletedCommandReport, getCommandParameters, getCommandParameterValue, getExecutionCommand, getHostRoleCommand, setExecutionCommand, setHostRoleCommand
public CommandReport execute(ConcurrentMap<String,Object> requestSharedDataContext) throws org.apache.ambari.server.AmbariException, InterruptedException
KerberosServerAction.processIdentities(java.util.Map)
to iterate through the Kerberos identity metadata and call
KerberosServerAction.processIdentities(java.util.Map)
for each identity to process.requestSharedDataContext
- a Map to be used as shared data among all ServerActions related
to a given requestorg.apache.ambari.server.AmbariException
InterruptedException
protected CommandReport processIdentity(ResolvedKerberosPrincipal resolvedPrincipal, KerberosOperationHandler operationHandler, Map<String,String> kerberosConfiguration, boolean includedInFilter, Map<String,Object> requestSharedDataContext) throws org.apache.ambari.server.AmbariException
SecurePasswordHelper.createSecurePassword()
. Then if the principal
does not exist in the KDC, create it using the generated password; else if it does exist update
its password. Finally store the generated password in the shared principal-to-password map and
store the new key numbers in the shared principal-to-key_number map so that subsequent process
may use the data if necessary.processIdentity
in class KerberosServerAction
resolvedPrincipal
- a ResolvedKerberosPrincipal object to processoperationHandler
- a KerberosOperationHandler used to perform Kerberos-related
tasks for specific Kerberos implementations
(MIT, Active Directory, etc...)kerberosConfiguration
- a Map of configuration properties from kerberos-envincludedInFilter
- a Boolean value indicating whather the principal is included in
the current filter or notrequestSharedDataContext
- a Map to be used as shared data among all ServerActions related
to a given request @return a CommandReport, indicating an error
condition; or null, indicating a success conditionorg.apache.ambari.server.AmbariException
- if an error occurs while processing the identity recordpublic CreatePrincipalsServerAction.CreatePrincipalResult createPrincipal(String principal, boolean isServicePrincipal, Map<String,String> kerberosConfiguration, KerberosOperationHandler kerberosOperationHandler, boolean regenerateKeytabs, ActionLog actionLog)
principal
- the principal name to createisServicePrincipal
- true if the principal is a service principal; false if the
principal is a user principalkerberosConfiguration
- the kerberos-env configuration propertieskerberosOperationHandler
- the KerberosOperationHandler for the relevant KDCregenerateKeytabs
- true if this was triggered in response to regenerating keytab files; false otherwiseactionLog
- the logger (may be null if no logging is desired)Copyright © 2022 Apache Software Foundation. All rights reserved.