Package com.nimbusds.common.servlet
Class ServletLogUtility
java.lang.Object
com.nimbusds.common.servlet.ServletLogUtility
Helper methods for Log4j message generation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
composeLogMessage
(jakarta.servlet.http.HttpServletRequest httpRequest) Composes a log message with the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.static void
log
(jakarta.servlet.http.HttpServletRequest httpRequest) Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.static void
log
(org.apache.logging.log4j.Logger log, jakarta.servlet.http.HttpServletRequest httpRequest) Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.
-
Method Details
-
composeLogMessage
Composes a log message with the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.Example:
HTTP POST request: ip=127.0.0.1 path=/json2ldap HTTPS POST request: ip=192.168.0.1 path=/authservice HTTPS CORS GET request: ip=192.168.0.1 origin=192.168.10.20 path=/json2ldap
- Parameters:
httpRequest
- The HTTP request. Must not benull
.- Returns:
- The log message.
-
log
Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.Example:
HTTP POST request: ip=127.0.0.1 path=/json2ldap HTTPS POST request: ip=192.168.0.1 path=/authservice HTTPS CORS GET request: ip=192.168.0.1 origin=192.168.10.20 path=/json2ldap
- Parameters:
httpRequest
- The HTTP request to log. Ifnull
the method will return immediately.
-
log
public static void log(org.apache.logging.log4j.Logger log, jakarta.servlet.http.HttpServletRequest httpRequest) Logs (at INFO level) the method, the client IP address, CORS origin (if any and a CORS Filter is configured) and the security client certificate principal (if any) of an HTTP request.Example:
HTTP POST request: ip=127.0.0.1 path=/json2ldap HTTPS POST request: ip=192.168.0.1 path=/authservice HTTPS CORS GET request: ip=192.168.0.1 origin=192.168.10.20 path=/json2ldap
- Parameters:
log
- The logger. Iftrue
the method will return immediately.httpRequest
- The HTTP request to log. Ifnull
the method will return immediately.
-