Interface AuthenticationControl
- All Superinterfaces:
Feature
Sessions are authenticated by a chain of authenticators. A client session can participate in the authentication process by creating an authenticator and registering it with the server.
Each authenticator is registered under a particular authenticator name. For
registration to succeed, the server's security configuration must include a
matching control-authentication-handler
entry for the name, otherwise
registration will fail and the authenticator will be closed immediately.
Each client session can register a single authenticator for a given authenticator name.
For each authentication event, the server will use its configuration to determine the authenticator priority order. The server may call authenticators in serial or parallel. The server may stop the authentication process as soon as it has an allow or deny response from an authenticator and all higher priority authenticators have abstained.
For a configured control authenticator, the server will select a single authenticator from those registered for the authenticator name. If no authenticators are currently registered, the server will consult the next configured authenticator in priority order.
Access control
In order to register an authenticator a session needs both
REGISTER_HANDLER
and
AUTHENTICATE
permissions.
In order to revoke a session's authentication a session needs both
MODIFY_SESSION
and
AUTHENTICATE
permissions.
Accessing the feature
This feature may be obtained from asession
as follows:
AuthenticationControl authenticationControl = session.feature(AuthenticationControl.class);
- Since:
- 5.0
- Author:
- DiffusionData Limited
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A control authenticator. -
Method Summary
Modifier and TypeMethodDescriptionrevokeAuthentication
(SessionId sessionId) Revokes a session's authentication.setAuthenticationHandler
(String name, AuthenticationControl.ControlAuthenticator authenticator) Register an authenticator for client authentication events.Methods inherited from interface com.pushtechnology.diffusion.client.session.Feature
getSession
-
Method Details
-
setAuthenticationHandler
CompletableFuture<Registration> setAuthenticationHandler(String name, AuthenticationControl.ControlAuthenticator authenticator) Register an authenticator for client authentication events.- Parameters:
name
- the authenticator name which must match an entry in the server's security configurationauthenticator
- specifies the authenticator- Returns:
- a CompletableFuture that completes when the authenticator has
been registered, returning a
Registration
which can be used to unregister the authenticator.Otherwise, the CompletableFuture will complete exceptionally with a
CompletionException
. Common reasons for failure, listed by the exception reported as thecause
, include:SessionClosedException
– if the session is closed;PermissionsException
– if the session does not haveREGISTER_HANDLER
andAUTHENTICATE
permission;SessionException
– will occur if the server configuration does not contain acontrol-authentication-handler
element with the given name.
- Since:
- 6.2
-
revokeAuthentication
Revokes a session's authentication.This will immediately close the specified client session.
- Parameters:
sessionId
- identifies the client session to revoke- Returns:
- a CompletableFuture that completes when a response is received
from the server.
If the identified session was revoked, the CompletableFuture will complete successfully. The result type is any rather than Void to provide forward compatibility with future iterations of this API that may provide a non-null result with a more specific result type.
Otherwise, the CompletableFuture will complete exceptionally with a
CompletionException
. Common reasons for failure, listed by the exception reported as thecause
, include:NoSuchSessionException
– if the identified session did not exist or was closed before the response was delivered;PermissionsException
– if the calling session does not haveAUTHENTICATE
andMODIFY_SESSION
permissions;SessionClosedException
– if the calling session is closed.
- Since:
- 6.12
-