Interface AuthenticationContext
- All Known Subinterfaces:
WebAuthenticationContext
AuthenticationContext contains information about the client and the network connection used by a
client that needs to be authenticated. This information can be used by a CustomAuthenticator or a
CustomWebAuthenticator implementation during authentication, or by a PostAuthenticationFilter
implementation to perform extra checks (such as validating the client's IP number against a list of allowed hosts)
after the user has been authenticated.
When used from a PostAuthenticationFilter implementation these attributes may be available:
- If the user has been authenticated using a X.509 certificate, then the certificate chain is available as a
java.security.cert.X509Certificate[]attribute that can be retrieved by calling thegetAttribute(java.lang.String)method with the namejavax.servlet.request.X509Certificate. - If the user has been authenticated using form based authentication, then a possibly empty
java.util.Map<String, java.util.List<String>>attribute is available and can be retrieved by calling thegetAttribute(java.lang.String)method with the namecom.spotfire.server.security.custom-parameters. This map contains all parameters with the prefixsf_custom_login_posted by a custom login page. Note that the prefix is stripped from the parameter names before they're added to the map. - If the user has been authenticated using
OpenID Connect, then the following attributes are available:- The access token as a
Stringattribute that can be retrieved by calling thegetAttribute(java.lang.String)method with the namecom.spotfire.server.security.oidc.access-token. - The (unparsed) ID token as a
Stringattribute that can be retrieved by calling thegetAttribute(java.lang.String)method with the namecom.spotfire.server.security.oidc.id-token.
- The access token as a
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.Returns anEnumerationcontaining the names of the attributes available to this request.Cookie[]Deprecated.longgetDateHeader(String name) getHeaders(String name) intgetIntHeader(String name) Delegates to the underlyingjavax.servlet.http.HttpServletRequest.Delegates to the underlyingjavax.servlet.http.HttpServletRequest.Delegates to the underlyingjavax.servlet.http.HttpServletRequest.Delegates to the underlyingjavax.servlet.http.HttpServletRequest.intDelegates to the underlyingjavax.servlet.http.HttpServletRequest.Delegates to the underlyingjavax.servlet.http.HttpServletRequest.intDelegates to the underlyingjavax.servlet.http.HttpServletRequest.Returns a mutable map, stored as a request attribute, that is only available from this interface.Delegates to the underlyingjavax.servlet.http.HttpServletRequest.intReturns the HTTP session ID.Returns a reference to the User Directory class, that can be used for reading and writing users and groups.booleanReturns the HTTP session ID.booleanReturns the HTTP session ID.booleanReturns the HTTP session ID.booleanisSecure()
-
Method Details
-
getRemoteAddr
String getRemoteAddr()- Returns:
- remote address
- Since:
- 3.0
-
getRemoteHost
String getRemoteHost()- Returns:
- remote host
- Since:
- 3.0
-
getServerName
String getServerName()- Returns:
- server name
- Since:
- 3.0
-
getServerPort
int getServerPort()- Returns:
- server port
- Since:
- 3.0
-
isSecure
boolean isSecure()- Returns:
- is secure
- Since:
- 3.0
-
getCookies
Deprecated.UsegetHeader("Cookie")instead to access the raw HTTP cookie dataThis method is deprecated, as theCookieclass changes package name in Java EE 9 fromjavax.servlet.http.Cookietojakarta.servlet.http.Cookie. The method invocationgetHeader("Cookie")can be used instead in order to access the raw HTTP cookie data.- Returns:
- cookies
- Since:
- 3.0
- See Also:
-
getDateHeader
- Parameters:
name- date header name- Returns:
- date header
- Since:
- 3.0
-
getHeader
- Parameters:
name- header name- Returns:
- header by name
- Since:
- 3.0
-
getHeaderNames
Enumeration<String> getHeaderNames()- Returns:
- header names
- Since:
- 3.0
-
getHeaders
- Parameters:
name- header name- Returns:
- headers by name
- Since:
- 3.0
-
getIntHeader
- Parameters:
name- header name- Returns:
- int value of the header
- Since:
- 3.0
-
getAttribute
Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.For requests made using HTTPS, the client certificates are available using both the old Java EE attribute name
javax.servlet.request.X509Certificateand the new Java EE 9 attribute namejakarta.servlet.request.X509Certificate. The usage of the old Java EE attribute name is deprecated.- Parameters:
name- attribute name- Returns:
- request attribute
- Since:
- 3.2
- See Also:
-
getAttributeNames
Enumeration<String> getAttributeNames()Returns anEnumerationcontaining the names of the attributes available to this request. This method returns an emptyEnumerationif the request has no attributes available to it.For requests made using HTTPS, the client certificates are available using both the old Java EE attribute name
javax.servlet.request.X509Certificateand the new Java EE 9 attribute namejakarta.servlet.request.X509Certificate. The usage of the old Java EE attribute name is deprecated.- Returns:
- an
Enumerationof strings containing the names of the request's attributes - Since:
- 3.2
- See Also:
-
getLocalAddr
String getLocalAddr()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the local address
- Since:
- 7.6
- See Also:
-
getLocalName
String getLocalName()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the local name
- Since:
- 7.6
- See Also:
-
getLocalPort
int getLocalPort()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the local port
- Since:
- 7.6
- See Also:
-
getLocale
Locale getLocale()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the preferred locale
- Since:
- 7.6
- See Also:
-
getLocales
Enumeration<Locale> getLocales()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the preferred locales
- Since:
- 7.6
- See Also:
-
getRemotePort
int getRemotePort()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the remote port
- Since:
- 7.6
- See Also:
-
getRequestedSessionId
String getRequestedSessionId()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.Note: the session ID should never be logged or exposed in any other way.
- Returns:
- the requested HTTP session ID
- Since:
- 7.6
- See Also:
-
getSessionId
String getSessionId()Returns the HTTP session ID.Note: the session ID should never be logged or exposed in any other way.
- Returns:
- the HTTP session ID
- Since:
- 7.6
- See Also:
-
isRequestedSessionIdFromCookie
boolean isRequestedSessionIdFromCookie()Returns the HTTP session ID.Note: the session ID should never be logged or exposed in any other way.
- Returns:
trueif the requested session ID came from a cookie, andfalseotherwise- Since:
- 7.6
- See Also:
-
isRequestedSessionIdFromURL
boolean isRequestedSessionIdFromURL()Returns the HTTP session ID.Note: the session ID should never be logged or exposed in any other way.
- Returns:
trueif the requested session ID came from the URL, andfalseotherwise- Since:
- 7.6
- See Also:
-
isRequestedSessionIdValid
boolean isRequestedSessionIdValid()Returns the HTTP session ID.Note: the session ID should never be logged or exposed in any other way.
- Returns:
trueif the requested session is valid, andfalseotherwise- Since:
- 7.6
- See Also:
-
getQueryString
String getQueryString()Delegates to the underlyingjavax.servlet.http.HttpServletRequest.- Returns:
- the query string or
null - Since:
- 7.8
- See Also:
-
getRequestContext
Returns a mutable map, stored as a request attribute, that is only available from this interface.Typically used to pass context information (that is only applicable during the current request) from for example a
CustomAuthenticatorimplementation to aPostAuthenticationFilterimplementation.- Returns:
- the request context
- Since:
- 7.11
-
getUserDirectory
UserDirectory getUserDirectory()Returns a reference to the User Directory class, that can be used for reading and writing users and groups.- Returns:
- a reference to the User Directory class
- Since:
- 10.1
-
getHeader("Cookie")instead to access the raw HTTP cookie data