Package net.shibboleth.idp.authn.impl
Class X509CertificateCredentialValidator
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.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.Logger
Class logger.private boolean
Whether 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 Subject
doValidate
(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext, CredentialValidator.WarningHandler warningHandler, CredentialValidator.ErrorHandler errorHandler) Override method for subclasses to use to perform the actual validation.protected Subject
populateSubject
(X509Certificate certificate) Builds a subject with "standard" content from the validation.void
Set the lookup strategy to locate theUsernamePasswordContext
.void
setSaveCertificateToCredentialSet
(boolean flag) Set whether to save the certificate in the Java Subject's public credentials.void
setTrustEngine
(TrustEngine<? super X509Credential> tm) Set aTrustEngine
to use.Methods inherited from class net.shibboleth.idp.authn.AbstractCredentialValidator
getLogPrefix, getSupportedPrincipals, isAcceptable, populateSubject, setActivationCondition, setId, setSupportedPrincipals, validate
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
doInitialize, getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.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 aTrustEngine
to 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:
doValidate
in 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
-