1package dev.rafex.ether.glowroot.jetty12;
3import java.util.Objects;
4import java.util.function.Function;
6import org.glowroot.agent.api.Glowroot;
34import dev.rafex.ether.http.core.HttpExchange;
35import dev.rafex.ether.http.core.HttpHandler;
36import dev.rafex.ether.http.core.Middleware;
64 private final Function<HttpExchange, String> userExtractor;
73 this.userExtractor = Objects.requireNonNull(userExtractor,
"userExtractor must not be null");
80 final var user = userExtractor.apply(exchange);
81 if (user !=
null && !user.isBlank()) {
82 Glowroot.setTransactionUser(user);
83 Glowroot.addTransactionAttribute(
"auth.user", user);
85 }
catch (
final Throwable ignore) {
88 return next.
handle(exchange);
HttpHandler wrap(final HttpHandler next)
GlowrootAuthUserMiddleware(final Function< HttpExchange, String > userExtractor)
Creates a middleware with the given user-extractor function.
boolean handle(HttpExchange exchange)