Package net.shibboleth.idp.plugin.authn.webauthn.audit.impl

# Class AbstractWebAuthnAuditingAction<T>

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.plugin.authn.webauthn.impl.AbstractWebAuthnAction<T>
net.shibboleth.idp.plugin.authn.webauthn.audit.impl.AbstractWebAuthnAuditingAction<T>

Type Parameters:
  `T` - the WebAuthn context type

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `ProfileAction`, `Aware`, `MessageSource`, `MessageSourceAware`, `Action`

Direct Known Subclasses:
  `AdminDeletePublicKeyCredential`, `DeletePublicKeyCredential`, `StorePublicKeyCredential`, `UpdateCredentialNickname`

public abstract class AbstractWebAuthnAuditingAction<T> extends AbstractWebAuthnAction<T>
A base class for actions that include audit logging support.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,AuditContext>`
`auditContextCreationStrategy`
Strategy used to locate or create the `AuditContext` to populate.
`private BiConsumer<ProfileRequestContext,String>`
`onFailureAuditHook`
A hook to be executed during a failure audit event.
`private BiConsumer<ProfileRequestContext,String>`
`onSuccessAuditHook`
A hook to be executed during a success audit event.
`private PopulateAuditContext`
`populateAuditContextAction`
Optional audit extraction action.
`private RequestContext`
`requestContext`
The Spring RequestContext to operate on.
`private WriteAuditLog`
`writeAuditLogAction`
Optional audit output action.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractWebAuthnAuditingAction(Function<ProfileRequestContext,T> defaultStrategy)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`auditFailure(ProfileRequestContext profileRequestContext, String action)`
Audit a failed operation.
`protected void`
`auditSuccess(ProfileRequestContext profileRequestContext, String action)`
Audit a successful operation.
`protected void`
`doAudit(ProfileRequestContext profileRequestContext, boolean success, String action)`
Do audit extraction and output.
`protected Event`
`doExecute(RequestContext springRequestContext, ProfileRequestContext profileRequestContext)`
`protected AuditContext`
`getAuditContext(ProfileRequestContext profileRequestContext)`
Create or locate the `AuditContext` via the defined strategy.
`protected Map<String,String>`
`getAuditFields(ProfileRequestContext profileRequestContext)`
Subclasses can override this method to supply additional audit fields to store.
`void`
`setAuditContextCreationStrategy(Function<ProfileRequestContext,AuditContext> strategy)`
Set the strategy used to locate the `AuditContext` associated with a given `ProfileRequestContext`.
`void`
`setOnFailureAuditHook(BiConsumer<ProfileRequestContext,String> hook)`
Set a hook to run on a failure audit event.
`void`
`setOnSuccessAuditHook(BiConsumer<ProfileRequestContext,String> hook)`
Set a hook to run on a success audit event.
`void`
`setPopulateAuditContextAction(PopulateAuditContext action)`
Sets an audit context population action to run.
`void`
`setWriteAuditLogAction(WriteAuditLog action)`
Sets an audit output action to run.

### Methods inherited from class net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnAction

`doExecute, doExecute, doInitialize, doPreExecute, doPreExecute, enhancedCredentialRecord, getAaguidMetadata, getAaguidService, getAuthenticatorMetadata, getCredentialRepository, getFidoMetadataService, getWebAuthnClient, setAaguidService, setCredentialRepository, setFidoMetadataService, setWebAuthnClient, setWebAuthnContextLookupStrategy`

### Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction

`execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy`

### Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction

`getActivationCondition, setActivationCondition`

### Methods inherited from class org.opensaml.profile.action.AbstractProfileAction

`doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplier`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, 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.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### auditContextCreationStrategy

@Nonnull private Function<ProfileRequestContext,AuditContext> auditContextCreationStrategy
Strategy used to locate or create the `AuditContext` to populate.

### populateAuditContextAction

@Nullable private PopulateAuditContext populateAuditContextAction
Optional audit extraction action.

### writeAuditLogAction

@Nullable private WriteAuditLog writeAuditLogAction
Optional audit output action.

### requestContext

@Nullable private RequestContext requestContext
The Spring RequestContext to operate on.

### onSuccessAuditHook

@Nonnull private BiConsumer<ProfileRequestContext,String> onSuccessAuditHook
A hook to be executed during a success audit event.

### onFailureAuditHook

@Nonnull private BiConsumer<ProfileRequestContext,String> onFailureAuditHook
A hook to be executed during a failure audit event.

## Constructor Details

### AbstractWebAuthnAuditingAction

protected AbstractWebAuthnAuditingAction(@Nonnull Function<ProfileRequestContext,T> defaultStrategy)
Constructor.

Parameters:
  `defaultStrategy` - the default audit context lookup strategy

## Method Details

### setAuditContextCreationStrategy

public void setAuditContextCreationStrategy(@Nonnull Function<ProfileRequestContext,AuditContext> strategy)
Set the strategy used to locate the `AuditContext` associated with a given `ProfileRequestContext`.

Parameters:
  `strategy` - lookup strategy

### setPopulateAuditContextAction

public void setPopulateAuditContextAction(@Nullable PopulateAuditContext action)
Sets an audit context population action to run.

Parameters:
  `action` - optional action to use to populate audit context

### setWriteAuditLogAction

public void setWriteAuditLogAction(@Nullable WriteAuditLog action)
Sets an audit output action to run.

Parameters:
  `action` - optional action to use to write to audit log

### getAuditContext

@Nullable protected AuditContext getAuditContext(@Nonnull ProfileRequestContext profileRequestContext)
Create or locate the `AuditContext` via the defined strategy.

Parameters:
  `profileRequestContext` - profile request context
Returns:
  the audit context

### setOnFailureAuditHook

public void setOnFailureAuditHook(@Nullable BiConsumer<ProfileRequestContext,String> hook)
Set a hook to run on a failure audit event.

Parameters:
  `hook` - the hook to set.
Since:
  1.3.0

### setOnSuccessAuditHook

public void setOnSuccessAuditHook(@Nullable BiConsumer<ProfileRequestContext,String> hook)
Set a hook to run on a success audit event.

Parameters:
  `hook` - the hook to set.
Since:
  1.3.0

### doExecute

protected Event doExecute(@Nonnull RequestContext springRequestContext, @Nonnull ProfileRequestContext profileRequestContext)

Overrides:
  `doExecute` in class `AbstractProfileAction`

### auditSuccess

protected void auditSuccess(@Nonnull ProfileRequestContext profileRequestContext, @Nullable String action)
Audit a successful operation. This will automatically add a 'success' field to the audit context. The `onSuccessAuditHook` is run before audit logging.

Parameters:
  `profileRequestContext` - the profile request context
  `action` - a descriptive string of the action that was performed. Can be `null` if not used.
Since:
  1.3.0

### auditFailure

protected void auditFailure(@Nonnull ProfileRequestContext profileRequestContext, @Nullable String action)
Audit a failed operation. This will automatically add a 'failure' field to the audit context. The `onFailureAuditHook` is run before audit logging.

Parameters:
  `profileRequestContext` - the profile request context
  `action` - a descriptive string of the action that was performed. Can be `null` if not used.
Since:
  1.3.0

### doAudit

protected void doAudit(@Nonnull ProfileRequestContext profileRequestContext, boolean success, @Nullable String action)
Do audit extraction and output.

Parameters:
  `profileRequestContext` - profile request context
  `success` - true iff this is an audit of successful action, false otherwise
  `action` - the type of action that was performed

### 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