Class WriteAuditLog
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,ProfileAction
,Aware
,MessageSource
,MessageSourceAware
,Action
AuditContext
and one or more formatting strings.- Event:
EventIds.PROCEED_EVENT_ID
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<ProfileRequestContext,
AuditContext> Strategy used to locate theAuditContext
associated with a givenProfileRequestContext
.private AuditContext
The AuditContext to operate on.private DateTimeFormatter
Formatter for date/time fields.Map of log category to formatting tokens and literals to output.private javax.servlet.http.HttpServletRequest
HttpServletRequest object.private final org.slf4j.Logger
Class logger.private RequestContext
The Spring RequestContext to operate on.private boolean
Convert date/time fields to default time zone. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doExecute
(ProfileRequestContext profileRequestContext) protected Event
doExecute
(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 void
protected boolean
doPreExecute
(ProfileRequestContext profileRequestContext) protected void
filter
(StringBuilder entry) Optional override to filter the outgoing log message, does nothing by default.Get the map of logging category to formatting tokens for log entries.void
Set the strategy used to locate theAuditContext
associated with a givenProfileRequestContext
.void
setDateTimeFormat
(String format) Set the formatting string to apply when extracting date/time fields.void
setFormattingMap
(Map<String, String> map) Set the map of logging category to formatting strings for log entries.void
setUseDefaultTimeZone
(boolean flag) Convert date/time fields to default time zone.Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
execute, getMessage, getMessage, getMessage, 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, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
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.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
auditContextLookupStrategy
Strategy used to locate theAuditContext
associated with a givenProfileRequestContext
. -
formattingMap
Map of log category to formatting tokens and literals to output. -
dateTimeFormatter
Formatter for date/time fields. -
useDefaultTimeZone
private boolean useDefaultTimeZoneConvert date/time fields to default time zone. -
requestContext
The Spring RequestContext to operate on. -
auditCtx
The AuditContext to operate on. -
httpRequest
@Nullable private javax.servlet.http.HttpServletRequest httpRequestHttpServletRequest object.
-
-
Constructor Details
-
WriteAuditLog
public WriteAuditLog()Constructor.
-
-
Method Details
-
setAuditContextLookupStrategy
public void setAuditContextLookupStrategy(@Nonnull Function<ProfileRequestContext, AuditContext> strategy) Set the strategy used to locate theAuditContext
associated with a givenProfileRequestContext
.- Parameters:
strategy
- lookup strategy
-
getFormattingMap
Get the map of logging category to formatting tokens for log entries.- Returns:
- map of formatting tokens
-
setFormattingMap
Set the map of logging category to formatting strings for log entries.A formatting string consists of tokens prefixed by '%' separated by any non-alphanumeric or whitespace. Tokens can contain any letter or number or a hyphen. Anything other than a token, including whitespace, is a literal.
- Parameters:
map
- map of categories to formatting strings
-
setDateTimeFormat
Set the formatting string to apply when extracting date/time fields.- Parameters:
format
- formatting string
-
setUseDefaultTimeZone
public void setUseDefaultTimeZone(boolean flag) Convert date/time fields to default time zone.- Parameters:
flag
- flag to set
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
doExecute
@Nonnull 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 aSpringRequestContext
attached 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
ProfileAction
interface. After execution, anEventContext
is sought, and used to return a result back to the Web Flow engine. If no context exists, a "proceed" event is signaled.- Overrides:
doExecute
in classAbstractProfileAction
- Parameters:
springRequestContext
- the Spring request contextprofileRequestContext
- a profile request context- Returns:
- a Web Flow event produced by the action
-
doPreExecute
- Overrides:
doPreExecute
in classAbstractConditionalProfileAction
-
doExecute
- Overrides:
doExecute
in classAbstractProfileAction
-
filter
Optional override to filter the outgoing log message, does nothing by default.- Parameters:
entry
- log entry
-