Package net.shibboleth.idp.authn.impl
Class AbstractAuditingValidationAction
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.authn.AbstractAuthenticationAction
net.shibboleth.idp.authn.AbstractValidationAction
net.shibboleth.idp.authn.impl.AbstractAuditingValidationAction
- All Implemented Interfaces:
PrincipalSupportingComponent,Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
- Direct Known Subclasses:
ValidateCredentials,ValidateExternalAuthentication,ValidateFunctionResult,ValidateRemoteUser,ValidateUserAgentAddress
Base class for validation actions that includes new audit logging support.
This is not great design, but embedding the existing audit action classes as fields is by far the simplest way to reuse that logic without getting caught up in the vagaries of the individual validator's logic.
- Since:
- 4.3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<ProfileRequestContext,AuditContext> Strategy used to locate or create theAuditContextto populate.private PopulateAuditContextOptional audit extraction action.private RequestContextThe Spring RequestContext to operate on.private WriteAuditLogOptional audit output action. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoAudit(ProfileRequestContext profileRequestContext, boolean success) Do audit extraction and output.protected EventdoExecute(RequestContext springRequestContext, ProfileRequestContext profileRequestContext) Spring-aware actions can override this method to fully control the execution of an Action by the Web Flow engine.protected AuditContextgetAuditContext(ProfileRequestContext profileRequestContext) Create or locate theAuditContextvia the defined strategy.getAuditFields(ProfileRequestContext profileRequestContext) Subclasses can override this method to supply additional audit fields to store.protected voidrecordFailure(ProfileRequestContext profileRequestContext) Record a failed authentication attempt against the configured counter.protected voidrecordSuccess(ProfileRequestContext profileRequestContext) Record a successful authentication attempt against the configured counter.voidSet the strategy used to locate theAuditContextassociated with a givenProfileRequestContext.voidSets an audit context population action to run.voidsetWriteAuditLogAction(WriteAuditLog action) Sets an audit output action to run.Methods inherited from class net.shibboleth.idp.authn.AbstractValidationAction
addDefaultPrincipals, buildAuthenticationResult, doPreExecute, getClassifiedErrors, getCleanupHook, getMetricName, getRequesterLookupStrategy, getResponderLookupStrategy, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, populateSubject, setAddDefaultPrincipals, setClassifiedMessages, setCleanupHook, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipalsMethods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doExecute, doPreExecute, setAuthenticationContextLookupStrategyMethods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, 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.InitializableComponent
initialize, isInitialized
-
Field Details
-
auditContextCreationStrategy
Strategy used to locate or create theAuditContextto populate. -
populateAuditContextAction
Optional audit extraction action. -
writeAuditLogAction
Optional audit output action. -
requestContext
The Spring RequestContext to operate on.
-
-
Constructor Details
-
AbstractAuditingValidationAction
public AbstractAuditingValidationAction()Constructor.
-
-
Method Details
-
setAuditContextCreationStrategy
public void setAuditContextCreationStrategy(@Nonnull Function<ProfileRequestContext, AuditContext> strategy) Set the strategy used to locate theAuditContextassociated with a givenProfileRequestContext.- Parameters:
strategy- lookup strategy
-
setPopulateAuditContextAction
Sets an audit context population action to run.- Parameters:
action- optional action to use to populate audit context- Since:
- 4.3.0
-
setWriteAuditLogAction
Sets an audit output action to run.- Parameters:
action- optional action to use to write to audit log- Since:
- 4.3.0
-
doExecute
protected Event doExecute(@Nonnull RequestContext springRequestContext, @Nonnull ProfileRequestContext profileRequestContext) Spring-aware actions can override this method to fully control the execution of an Action by the Web Flow engine.Alternatively they may override
AbstractProfileAction.doExecute(ProfileRequestContext)and access Spring information via aSpringRequestContextattached to the profile request context.The default implementation attaches the Spring Web Flow request context to the profile request context tree to "narrow" the execution signature to the basic OpenSAML
ProfileActioninterface. After execution, anEventContextis sought, and used to return a result back to the Web Flow engine. If no context exists, a "proceed" event is signaled.- Overrides:
doExecutein classAbstractProfileAction- Parameters:
springRequestContext- the Spring request contextprofileRequestContext- a profile request context- Returns:
- a Web Flow event produced by the action
-
recordSuccess
Record a successful authentication attempt against the configured counter. Records nothing if the metrics registry is not installed into the runtime.- Overrides:
recordSuccessin classAbstractValidationAction- Parameters:
profileRequestContext- profile request context
-
recordFailure
Record a failed authentication attempt against the configured counter. Records nothing if the metrics registry is not installed into the runtime.- Overrides:
recordFailurein classAbstractValidationAction- Parameters:
profileRequestContext- profile request context
-
getAuditContext
@Nullable protected AuditContext getAuditContext(@Nonnull ProfileRequestContext profileRequestContext) Create or locate theAuditContextvia the defined strategy.- Parameters:
profileRequestContext- profile request context- Returns:
- the audit context
-
doAudit
Do audit extraction and output.- Parameters:
profileRequestContext- profile request contextsuccess- true iff this is an audit of successful validation
-
getAuditFields
@Nullable @Unmodifiable @NotLive protected Map<String,String> getAuditFields(@Nonnull ProfileRequestContext profileRequestContext) Subclasses can override this method to supply additional audit fields to store.- Parameters:
profileRequestContext- profile request context- Returns:
- audit fields
-