Module org.elasticsearch.security
Class InstrumentedSecurityActionListener
java.lang.Object
org.elasticsearch.xpack.security.metric.InstrumentedSecurityActionListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <R,C> ActionListener <AuthenticationResult<R>> wrapForAuthc(SecurityMetrics<C> metrics, C context, ActionListener<AuthenticationResult<R>> listener) Wraps the providedlistenerand returns a new wrapped listener which handles authentication metrics collection.static <R> ActionListener<AuthenticationResult<R>> wrapForAuthc(SecurityMetrics<AuthenticationResult<R>> metrics, ActionListener<AuthenticationResult<R>> listener) A simpler variant that re-uses the Authentication Result as the context.
-
Constructor Details
-
InstrumentedSecurityActionListener
public InstrumentedSecurityActionListener()
-
-
Method Details
-
wrapForAuthc
public static <R,C> ActionListener<AuthenticationResult<R>> wrapForAuthc(SecurityMetrics<C> metrics, C context, ActionListener<AuthenticationResult<R>> listener) Wraps the providedlistenerand returns a new wrapped listener which handles authentication metrics collection.- Type Parameters:
R- The type of authentication result value.C- The type of context object which is used to attach additional attributes to collected authentication metrics.- Parameters:
metrics- The metrics to collect.context- The context object is used to collect and attach additional metric attributes.listener- The authentication result handling listener.- Returns:
- a new "wrapped" listener which overrides onResponse and onFailure methods in order to collect authentication metrics.
-
wrapForAuthc
public static <R> ActionListener<AuthenticationResult<R>> wrapForAuthc(SecurityMetrics<AuthenticationResult<R>> metrics, ActionListener<AuthenticationResult<R>> listener) A simpler variant that re-uses the Authentication Result as the context. This can be handy in situations where the attributes that are of interest are available only after the authentication is completed and not before. As a natural consequence, there will be no context available at the point of recording start time and in cases of exceptional failure
-