public final class ClientContext extends AbstractContext
Modifier and Type | Class and Description |
---|---|
static class |
ClientContext.Builder
Builder for creating
ClientContext instances. |
data
Constructor and Description |
---|
ClientContext(JsonValue savedContext,
ClassLoader classLoader)
Restore from JSON representation.
|
Modifier and Type | Method and Description |
---|---|
static ClientContext.Builder |
buildExternalClientContext(Context parent)
Creates a
ClientContext.Builder for creating an external ClientContext instance. |
Collection<? extends Certificate> |
getCertificates()
Returns the collection (possibly empty) of certificate(s) provided by the client.
|
String |
getLocalAddress()
Returns the IP address of the interface that received the request.
|
int |
getLocalPort()
Returns the port of the interface that received the request.
|
String |
getRemoteAddress()
Returns the IP address of the client (or last proxy) that sent the request
or an empty string if the client is internal.
|
int |
getRemotePort()
Returns the source port of the client (or last proxy) that sent the request
or
-1 if the client is internal. |
String |
getRemoteUser()
Returns the login of the user making this request or an empty string if not known.
|
String |
getUserAgent()
Returns the value of the User-Agent HTTP Header (if any, returns an empty string otherwise).
|
boolean |
isExternal()
Returns
true if this client is external. |
boolean |
isSecure()
Returns
true if this client connection is secure. |
static ClientContext |
newInternalClientContext(Context parent)
Creates an internal
ClientContext instance. |
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
public ClientContext(JsonValue savedContext, ClassLoader classLoader)
savedContext
- The JSON representation from which this context's attributes
should be parsed.classLoader
- The ClassLoader which can properly resolve the persisted class-name.public static ClientContext.Builder buildExternalClientContext(Context parent)
ClientContext.Builder
for creating an external ClientContext
instance.parent
- The parent context.ClientContext
instance.public static ClientContext newInternalClientContext(Context parent)
ClientContext
instance.
All data related to external context (e.g remote address, user agent...) will be set with empty non null values.
The returned internal ClientContext
is considered as secure.parent
- The parent context.ClientContext
instance.public String getRemoteUser()
public String getRemoteAddress()
public int getRemotePort()
-1
if the client is internal.-1
if the client is internal.public Collection<? extends Certificate> getCertificates()
public String getUserAgent()
public boolean isExternal()
true
if this client is external.true
if this client is external.public boolean isSecure()
true
if this client connection is secure.
It is the responsibility to the underlying protocol/implementation
to determine whether or not the connection is secure.
For example HTTPS and internal connections are meant to be secure.true
if this client connection is secure.public String getLocalAddress()
public int getLocalPort()
Copyright © 2010-2018, ForgeRock All Rights Reserved.