Package org.apache.solr.security
Class AuditEvent
- java.lang.Object
-
- org.apache.solr.security.AuditEvent
-
public class AuditEvent extends Object
Audit event that takes request and auth context as input to be able to audit log custom things. This interface may change in next release and is marked experimental- Since:
- 8.1.0
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AuditEvent.EventType
static class
AuditEvent.Level
static class
AuditEvent.RequestType
-
Constructor Summary
Constructors Modifier Constructor Description protected
AuditEvent()
AuditEvent(AuditEvent.EventType eventType)
Empty event, must be filled by user using setters.AuditEvent(AuditEvent.EventType eventType, Throwable exception, javax.servlet.http.HttpServletRequest httpRequest)
Event based on an HttpServletRequest, typically used during authentication.AuditEvent(AuditEvent.EventType eventType, javax.servlet.http.HttpServletRequest httpRequest)
AuditEvent(AuditEvent.EventType eventType, javax.servlet.http.HttpServletRequest httpRequest, AuthorizationContext authorizationContext)
Event based on request and AuthorizationContext.AuditEvent(AuditEvent.EventType eventType, javax.servlet.http.HttpServletRequest httpRequest, AuthorizationContext authorizationContext, double qTime, Throwable exception)
Event to log completed requests.
-
Method Summary
-
-
-
Constructor Detail
-
AuditEvent
public AuditEvent(AuditEvent.EventType eventType)
Empty event, must be filled by user using setters. Message and Loglevel will be initialized from EventType but can be overridden with setters afterwards.- Parameters:
eventType
- a predefined or custom EventType
-
AuditEvent
public AuditEvent(AuditEvent.EventType eventType, javax.servlet.http.HttpServletRequest httpRequest)
-
AuditEvent
protected AuditEvent()
-
AuditEvent
public AuditEvent(AuditEvent.EventType eventType, Throwable exception, javax.servlet.http.HttpServletRequest httpRequest)
Event based on an HttpServletRequest, typically used during authentication. Solr will fill in details such as ip, http method etc from the request, and username if Principal exists on the request.- Parameters:
eventType
- a predefined or custom EventTypehttpRequest
- the request to initialize from
-
AuditEvent
public AuditEvent(AuditEvent.EventType eventType, javax.servlet.http.HttpServletRequest httpRequest, AuthorizationContext authorizationContext)
Event based on request and AuthorizationContext. Solr will fill in details such as collections, ip, http method etc from the context.- Parameters:
eventType
- a predefined or custom EventTypehttpRequest
- the request to initialize fromauthorizationContext
- the context to initialize from
-
AuditEvent
public AuditEvent(AuditEvent.EventType eventType, javax.servlet.http.HttpServletRequest httpRequest, AuthorizationContext authorizationContext, double qTime, Throwable exception)
Event to log completed requests. Takes time and status. Solr will fill in details such as collections, ip, http method etc from the HTTP request and context.- Parameters:
eventType
- a predefined or custom EventTypehttpRequest
- the request to initialize fromauthorizationContext
- the context to initialize fromqTime
- query timeexception
- exception from query response, or null if OK
-
-
Method Detail
-
getMessage
public String getMessage()
-
getLevel
public AuditEvent.Level getLevel()
-
getDate
public Date getDate()
-
getUsername
public String getUsername()
-
getSession
public String getSession()
-
getClientIp
public String getClientIp()
-
getResource
public String getResource()
-
getHttpMethod
public String getHttpMethod()
-
getHttpQueryString
public String getHttpQueryString()
-
getEventType
public AuditEvent.EventType getEventType()
-
getSolrHost
public String getSolrHost()
-
getSolrIp
public String getSolrIp()
-
getSolrPort
public int getSolrPort()
-
getAutResponse
public AuthorizationResponse getAutResponse()
-
getNodeName
public String getNodeName()
-
getRequestType
public AuditEvent.RequestType getRequestType()
-
getStatus
public int getStatus()
-
getQTime
public double getQTime()
-
getException
public Throwable getException()
-
getRequestUrl
public StringBuffer getRequestUrl()
-
setRequestUrl
public AuditEvent setRequestUrl(StringBuffer requestUrl)
-
setSession
public AuditEvent setSession(String session)
-
setClientIp
public AuditEvent setClientIp(String clientIp)
-
setContext
public AuditEvent setContext(Map<String,Object> context)
-
setContextEntry
public AuditEvent setContextEntry(String key, Object value)
-
setMessage
public AuditEvent setMessage(String message)
-
setLevel
public AuditEvent setLevel(AuditEvent.Level level)
-
setDate
public AuditEvent setDate(Date date)
-
setUsername
public AuditEvent setUsername(String username)
-
setCollections
public AuditEvent setCollections(List<String> collections)
-
setResource
public AuditEvent setResource(String resource)
-
setHttpMethod
public AuditEvent setHttpMethod(String httpMethod)
-
setHttpQueryString
public AuditEvent setHttpQueryString(String httpQueryString)
-
setSolrHost
public AuditEvent setSolrHost(String solrHost)
-
setSolrPort
public AuditEvent setSolrPort(int solrPort)
-
setSolrIp
public AuditEvent setSolrIp(String solrIp)
-
setHeaders
public AuditEvent setHeaders(Map<String,String> headers)
-
setSolrParams
public AuditEvent setSolrParams(Map<String,List<String>> solrParams)
-
setAutResponse
public AuditEvent setAutResponse(AuthorizationResponse autResponse)
-
setRequestType
public AuditEvent setRequestType(AuditEvent.RequestType requestType)
-
setQTime
public AuditEvent setQTime(double QTime)
-
setStatus
public AuditEvent setStatus(int status)
-
setException
public AuditEvent setException(Throwable exception)
-
-