Middleware that sets the authenticated user on the Glowroot transaction. More...
Public Member Functions | |
| GlowrootAuthUserMiddleware (final Function< HttpExchange, String > userExtractor) | |
| Creates a middleware with the given user-extractor function. | |
| HttpHandler | wrap (final HttpHandler next) |
Middleware that sets the authenticated user on the Glowroot transaction.
Calls Glowroot#setTransactionUser(String) with the value returned by a configurable userExtractor function. If the extractor returns null or blank, the user is not set.
For Jetty-specific extraction from JWT auth context use GlowrootJettyExtractors#authUser() to obtain the extractor:
middlewareRegistry.add(new GlowrootAuthUserMiddleware(GlowrootJettyExtractors.authUser()));
Setting the user enables Glowroot's "User recording" — you can search all slow traces for a specific user, invaluable for debugging user-specific issues.
Definition at line 62 of file GlowrootAuthUserMiddleware.java.
| dev.rafex.ether.glowroot.jetty12.GlowrootAuthUserMiddleware.GlowrootAuthUserMiddleware | ( | final Function< HttpExchange, String > | userExtractor | ) |
Creates a middleware with the given user-extractor function.
| userExtractor | function that derives the user identifier from an HttpExchange; must not be null |
Definition at line 72 of file GlowrootAuthUserMiddleware.java.
| HttpHandler dev.rafex.ether.glowroot.jetty12.GlowrootAuthUserMiddleware.wrap | ( | final HttpHandler | next | ) |
Implements dev.rafex.ether.http.core.Middleware.
Definition at line 77 of file GlowrootAuthUserMiddleware.java.
References dev.rafex.ether.http.core.HttpHandler.handle().