Class HttpRequestClientInfoAdapter
- All Implemented Interfaces:
IClientInfoPort
IClientInfoPort implementation that resolves the caller purely
from the current HTTP request's client IP address, via
RequestClientIpResolver.
Resolving a caller's IP address has nothing to do with Spring
Security. This adapter exists for applications that carry Spring Web but
not Spring Security at all — for example, an internal microservice
behind a gateway that already authenticates the caller upstream. Such a
service still benefits from knowing which address a call came from, even
though it never performs authentication itself, so it should not be
forced to fall back to "unknown" just because Spring Security is
absent from its classpath.
LoggedAutoConfiguration
only activates this adapter when SpringSecurityClientInfoAdapter
itself is not active (Spring Security missing), so an application with
Spring Security still gets the richer, authentication-aware resolution.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResolves an identifier describing who triggered the current invocation.
-
Constructor Details
-
HttpRequestClientInfoAdapter
public HttpRequestClientInfoAdapter(boolean trustForwardedHeaders)
-
-
Method Details
-
resolveCallerIdentity
Description copied from interface:IClientInfoPortResolves an identifier describing who triggered the current invocation.- Specified by:
resolveCallerIdentityin interfaceIClientInfoPort- Returns:
- a caller identity such as
"user:42"or"ip:203.0.113.10", or an implementation-defined placeholder such as"unknown"if no identity can be resolved
-