Package org.mockserver.authentication
Class AuthenticationResult
java.lang.Object
org.mockserver.authentication.AuthenticationResult
Immutable outcome of authenticating a control-plane request, carrying not just
the boolean decision but the VERIFIED principal, the source of that verification,
and a redaction-safe subset of token claims and scopes.
This is the richer return type for AuthenticationHandler.authenticate(org.mockserver.model.HttpRequest). The
legacy boolean SPI (AuthenticationHandler.controlPlaneRequestAuthenticated(org.mockserver.model.HttpRequest))
is preserved and adapted via a default method, so existing (and third-party)
handlers keep working unchanged and the control plane behaves byte-for-byte
identically when no enriched handler is configured.
Construct only via the authenticated / unauthenticated() factories;
all collections are wrapped unmodifiable and never null.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationResultauthenticated(String principal, String principalSource, Map<String, Object> claims, Set<String> scopes) An authenticated result.booleanstatic AuthenticationResult
-
Method Details
-
authenticated
public static AuthenticationResult authenticated(String principal, String principalSource, Map<String, Object> claims, Set<String> scopes) An authenticated result.- Parameters:
principal- the verified principal (e.g. thesubclaim), or null for an authenticated-but-anonymous handler (e.g. mTLS-only)principalSource- how the principal was verified: "verified-oidc" / "verified-mtls" / "verified-jwt" / "none"claims- a redaction-safe subset of token claims (NEVER the raw token); may be empty, never nullscopes- normalised granted scopes; may be empty, never null
-
unauthenticated
-
isAuthenticated
public boolean isAuthenticated() -
getPrincipal
-
getPrincipalSource
-
getClaims
-
getScopes
-