Interface CustomAuthenticator
A custom authenticator is an implementation of this interface. A custom authenticator is a suitable option when the user identity can be retrieved from an HTTP header or similar but the built-in functionality for retrieving such isn't sufficient - for example if the header contains a token that must be validated against some external service to establish the user identity.
An alternative to implementing this interface may be to implement a PostAuthenticationFilter
, if the user
identity can be established through some built-in authentication method and all that is needed is some additional
verification (to impose restrictions on the IP number of the client for example).
If the authentication is based on username/password but some additional information needs to be collected from the
user and verified it's better to combine a custom login page with a PostAuthenticationFilter
and
possibly a custom JAAS Login Module
Implementations of this interface must be thread-safe and reentrant.
- Since:
- 7.6
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(AuthenticationContext authContext) Performs authentication based on the providedAuthenticationContext
.default void
init
(CustomAuthenticatorInitContext initContext) Initializes thisCustomAuthenticator
.default void
Deprecated.This method is deprecated and will be removed in a future release.
-
Method Details
-
init
Initializes thisCustomAuthenticator
.The default implementation calls the deprecated
init(Map)
method.- Parameters:
initContext
- an initialization context containing parameters and other information that may be used by the implementing class- Throws:
CustomAuthenticatorException
- if the initialization failed- Since:
- 10.1
-
init
Deprecated.This method is deprecated and will be removed in a future release. Please implement theinit(CustomAuthenticatorInitContext)
method instead.Initializes thisCustomAuthenticator
.The default implementation does nothing.
- Parameters:
parameters
- a possibly empty map of initialization parameters- Throws:
CustomAuthenticatorException
- if the initialization failed- Since:
- 7.6
-
authenticate
CustomAuthenticatorPrincipal authenticate(AuthenticationContext authContext) throws CustomAuthenticatorException Performs authentication based on the providedAuthenticationContext
.- If the method returns a principal, the Spotfire Server will use this identity without performing any further authentication.
- If the method returns
null
, the Spotfire Server may attempt to perform authentication using another authentication method. - If the method throws an exception, the Spotfire server will not attempt to perform authentication using any other authentication method and an error will be returned to the client.
- Parameters:
authContext
- the context in which the authentication takes place, containing information mainly from theHttpServletRequest
- Returns:
- the authenticated principal or
null
if no (valid) credentials were included and authentication may be attempted using another authentication method - Throws:
CustomAuthenticatorException
- if the authentication failed and authentication may not be attempted using another authentication method- Since:
- 7.6
-