public final class ESAPI extends Object
Modifier and Type | Method and Description |
---|---|
static AccessController |
accessController() |
static Authenticator |
authenticator() |
static void |
clearCurrent()
Clears the current User, HttpRequest, and HttpResponse associated with the current thread.
|
static javax.servlet.http.HttpServletRequest |
currentRequest()
Get the current HTTP Servlet Request being processed.
|
static javax.servlet.http.HttpServletResponse |
currentResponse()
Get the current HTTP Servlet Response being generated.
|
static Encoder |
encoder()
The ESAPI Encoder is primarily used to provide output encoding to
prevent Cross-Site Scripting (XSS).
|
static Encryptor |
encryptor() |
static Executor |
executor() |
static Logger |
getLogger(Class clazz) |
static Logger |
getLogger(String moduleName) |
static HTTPUtilities |
httpUtilities() |
static String |
initialize(String impl) |
static IntrusionDetector |
intrusionDetector() |
static Logger |
log() |
static void |
override(SecurityConfiguration config)
Overrides the current security configuration with a new implementation.
|
static Randomizer |
randomizer() |
static SecurityConfiguration |
securityConfiguration() |
static Validator |
validator() |
public static void clearCurrent()
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException { try { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; ESAPI.httpUtilities().setCurrentHTTP(request, response); ESAPI.authenticator().login(); chain.doFilter(request, response); } catch (Exception e) { logger.error( Logger.SECURITY_FAILURE, "Error in ESAPI security filter: " + e.getMessage(), e ); } finally { // VERY IMPORTANT // clear out ThreadLocal variables ESAPI.clearCurrent(); } }The advantages of having identity everywhere are worth the risk here.
public static javax.servlet.http.HttpServletRequest currentRequest()
public static javax.servlet.http.HttpServletResponse currentResponse()
public static AccessController accessController()
public static Authenticator authenticator()
public static Encoder encoder()
public static Encryptor encryptor()
public static Executor executor()
public static HTTPUtilities httpUtilities()
public static IntrusionDetector intrusionDetector()
public static Logger getLogger(Class clazz)
clazz
- The class to associate the logger with.public static Logger getLogger(String moduleName)
moduleName
- The module to associate the logger with.public static Logger log()
public static Randomizer randomizer()
public static SecurityConfiguration securityConfiguration()
public static Validator validator()
public static void override(SecurityConfiguration config)
config
- The new security configuration.Copyright © 2024 The Open Worldwide Application Security Project (OWASP). All rights reserved.