Package net.shibboleth.idp.authn.impl
Class X509CertificateCredentialValidator
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.idp.authn.AbstractCredentialValidator
net.shibboleth.idp.authn.impl.X509CertificateCredentialValidator
- All Implemented Interfaces:
CredentialValidator,PrincipalSupportingComponent,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
@ThreadSafeAfterInit
public class X509CertificateCredentialValidator
extends AbstractCredentialValidator
A credential validator that validates an X.509 certificate.
- Since:
- 4.2.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.shibboleth.idp.authn.CredentialValidator
CredentialValidator.ErrorHandler, CredentialValidator.WarningHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionLookup strategy for cert context.private final org.slf4j.LoggerClass logger.private booleanWhether to save the certificate in the Java Subject's public credentials.private TrustEngine<? super X509Credential>Optional trust engine to validate certificates against. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SubjectdoValidate(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext, CredentialValidator.WarningHandler warningHandler, CredentialValidator.ErrorHandler errorHandler) Override method for subclasses to use to perform the actual validation.protected SubjectpopulateSubject(X509Certificate certificate) Builds a subject with "standard" content from the validation.voidSet the lookup strategy to locate theUsernamePasswordContext.voidsetSaveCertificateToCredentialSet(boolean flag) Set whether to save the certificate in the Java Subject's public credentials.voidsetTrustEngine(TrustEngine<? super X509Credential> tm) Set aTrustEngineto use.Methods inherited from class net.shibboleth.idp.authn.AbstractCredentialValidator
getLogPrefix, getSupportedPrincipals, isAcceptable, populateSubject, setActivationCondition, setId, setSupportedPrincipals, validateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
doInitialize, 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. -
certContextLookupStrategy
Lookup strategy for cert context. -
trustEngine
Optional trust engine to validate certificates against. -
saveCertificateToCredentialSet
private boolean saveCertificateToCredentialSetWhether to save the certificate in the Java Subject's public credentials.
-
-
Constructor Details
-
X509CertificateCredentialValidator
public X509CertificateCredentialValidator()Constructor.
-
-
Method Details
-
setCertificateContextLookupStrategy
public void setCertificateContextLookupStrategy(@Nonnull Function<AuthenticationContext, CertificateContext> strategy) Set the lookup strategy to locate theUsernamePasswordContext.- Parameters:
strategy- lookup strategy
-
setTrustEngine
Set aTrustEngineto use.- Parameters:
tm- trust engine to use
-
setSaveCertificateToCredentialSet
public void setSaveCertificateToCredentialSet(boolean flag) Set whether to save the certificate in the Java Subject's public credentials.Defaults to true
- Parameters:
flag- flag to set
-
doValidate
@Nullable protected Subject doValidate(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext, @Nullable CredentialValidator.WarningHandler warningHandler, @Nullable CredentialValidator.ErrorHandler errorHandler) throws Exception Override method for subclasses to use to perform the actual validation.- Specified by:
doValidatein classAbstractCredentialValidator- Parameters:
profileRequestContext- profile request contextauthenticationContext- authentication contextwarningHandler- optional warning handler interfaceerrorHandler- optional error handler interface- Returns:
- the validated result, or null if inapplicable
- Throws:
Exception- if an error occurs
-
populateSubject
Builds a subject with "standard" content from the validation.- Parameters:
certificate- the certificate validated- Returns:
- the decorated subject
-