Package net.shibboleth.idp.authn.impl
Class KerberosCredentialValidator
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.idp.authn.AbstractCredentialValidator
net.shibboleth.idp.authn.AbstractUsernamePasswordCredentialValidator
net.shibboleth.idp.authn.impl.KerberosCredentialValidator
- All Implemented Interfaces:
CredentialValidator,PrincipalSupportingComponent,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
@ThreadSafeAfterInit
public class KerberosCredentialValidator
extends AbstractUsernamePasswordCredentialValidator
A password validator that authenticates against Kerberos natively, with optional service ticket verification.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classA callback handler that provides static name and password data to a JAAS login process.Nested classes/interfaces inherited from interface net.shibboleth.idp.authn.CredentialValidator
CredentialValidator.ErrorHandler, CredentialValidator.WarningHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionJAAS options for client login.private StringPath to keytab for service principal.private final org.slf4j.LoggerClass logger.private StringClass name of JAAS LoginModule to acquire Kerberos credentials.private booleanSave the TGT in the resulting Subject?private booleanRefresh the Kerberos config before running?JAAS options for server login.private StringService principal to acquire a ticket for to verify KDC. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected SubjectdoValidate(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext, UsernamePasswordContext usernamePasswordContext, CredentialValidator.WarningHandler warningHandler, CredentialValidator.ErrorHandler errorHandler) Override method for subclasses to use to perform the actual validation.protected SubjectpopulateSubject(Subject subject, UsernamePasswordContext usernamePasswordContext) Decorate the subject with "standard" content from the validation and clean up as instructed.voidsetKeytabPath(String path) Provides a keytab for the service principal to use to verify the KDC.voidSet the name of the JAAS LoginModule to use to acquire Kerberos credentials.voidsetPreserveTicket(boolean flag) Set whether to save the TGT in the Subject.voidsetRefreshKrb5Config(boolean flag) Set whether to refresh the Kerberos configuration before running.voidsetServicePrincipal(String name) Set the name of a service principal to use to verify the KDC.private voidUse credentials to acquire and verify a service ticket.Methods inherited from class net.shibboleth.idp.authn.AbstractUsernamePasswordCredentialValidator
applyTransforms, doValidate, savePasswordToCredentialSet, setLowercase, setMatchExpression, setSavePasswordToCredentialSet, setTransforms, setTrim, setUppercase, setUsernamePasswordContextLookupStrategyMethods inherited from class net.shibboleth.idp.authn.AbstractCredentialValidator
getLogPrefix, getSupportedPrincipals, isAcceptable, populateSubject, setActivationCondition, setId, setSupportedPrincipals, validateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
loginModuleClassName
Class name of JAAS LoginModule to acquire Kerberos credentials. -
refreshKrb5Config
private boolean refreshKrb5ConfigRefresh the Kerberos config before running? -
preserveTicket
private boolean preserveTicketSave the TGT in the resulting Subject? -
servicePrincipal
Service principal to acquire a ticket for to verify KDC. -
keytabPath
Path to keytab for service principal. -
clientOptions
JAAS options for client login. -
serverOptions
JAAS options for server login.
-
-
Constructor Details
-
KerberosCredentialValidator
public KerberosCredentialValidator()Constructor.
-
-
Method Details
-
setLoginModuleClassName
Set the name of the JAAS LoginModule to use to acquire Kerberos credentials.- Parameters:
name- name of login module class
-
setRefreshKrb5Config
public void setRefreshKrb5Config(boolean flag) Set whether to refresh the Kerberos configuration before running.- Parameters:
flag- flag to set
-
setPreserveTicket
public void setPreserveTicket(boolean flag) Set whether to save the TGT in the Subject.- Parameters:
flag- flag to set
-
setServicePrincipal
Set the name of a service principal to use to verify the KDC.If non-null, a keytab resource must also be set.
- Parameters:
name- name of service principal
-
setKeytabPath
Provides a keytab for the service principal to use to verify the KDC.- Parameters:
path- path to file containing a keytab
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
doValidate
protected Subject doValidate(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext, @Nonnull UsernamePasswordContext usernamePasswordContext, @Nullable CredentialValidator.WarningHandler warningHandler, @Nullable CredentialValidator.ErrorHandler errorHandler) throws Exception Override method for subclasses to use to perform the actual validation.Any configured transforms will have been applied to populate the context with a transformed username prior to this method call.
- Specified by:
doValidatein classAbstractUsernamePasswordCredentialValidator- Parameters:
profileRequestContext- profile request contextauthenticationContext- authentication contextusernamePasswordContext- the username/password to validatewarningHandler- optional warning handler interfaceerrorHandler- optional error handler interface- Returns:
- the validated result, or null if inapplicable
- Throws:
Exception- if an error occurs
-
populateSubject
@Nonnull protected Subject populateSubject(@Nonnull Subject subject, @Nonnull UsernamePasswordContext usernamePasswordContext) Decorate the subject with "standard" content from the validation and clean up as instructed.- Overrides:
populateSubjectin classAbstractUsernamePasswordCredentialValidator- Parameters:
subject- the subject being returnedusernamePasswordContext- the username/password validated- Returns:
- the decorated subject
-
verifyKDC
Use credentials to acquire and verify a service ticket.- Parameters:
subject- client identity- Throws:
Exception- if an error occurs
-