Interface Security
- All Superinterfaces:
Feature
Access control
There are no permissions requirements associated with this feature. The client provides credentials that authenticate the principal.Accessing the feature
This feature may be obtained from asession
as follows:
Security security = session.feature(Security.class);
- Since:
- 5.0
- Author:
- DiffusionData Limited
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<Boolean>
changePrincipal
(String principal, Credentials credentials) Deprecated.since 6.12Query the global permissions assigned to the calling session.getPermissionsForPath
(String path) Query the path permissions assigned to the calling session on a given path.reauthenticate
(String principal, Credentials credentials, Map<String, String> properties) Re-authenticate the session.Methods inherited from interface com.pushtechnology.diffusion.client.session.Feature
getSession
-
Method Details
-
reauthenticate
CompletableFuture<Boolean> reauthenticate(String principal, Credentials credentials, Map<String, String> properties) Re-authenticate the session.This may be used to change the principal for the session, or to re-authenticate the session before it expires.
A session may determine when it is due to expire by querying the value of the
EXPIRY_TIME
session property usingSession.getSessionProperties()
. If this property is not present the session will not expire and there is no need to re-authenticate unless the principal in use is to be changed.- Parameters:
principal
- the principal name. This may be the same principal as supplied when the session was originally opened, or it may be an entirely different principal.credentials
- the credentials authenticating the principalproperties
- a map of the proposed user session properties. The supplied properties will be validated during authentication and may be discarded or changed. If no user properties are required, anempty map
should be supplied.- Returns:
- a CompletableFuture that completes when a response is received
from the server.
If authentication succeeded, the CompletableFuture will complete successfully with a
TRUE
result.If authentication failed because the
principal
was unknown or thecredentials
were invalid, the session will not have been re-authenticated and the CompletableFuture will complete successfully with aFALSE
result.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.
- Since:
- 6.12
-
changePrincipal
@Deprecated default CompletableFuture<Boolean> changePrincipal(String principal, Credentials credentials) Deprecated.since 6.12Use the new
reauthenticate(java.lang.String, com.pushtechnology.diffusion.client.types.Credentials, java.util.Map<java.lang.String, java.lang.String>)
in preference, which allows user proposed session properties to be supplied. This method will be removed in a future release.Change the security principal associated with the session.- Parameters:
principal
- the new principal namecredentials
- the credentials authenticating the new principal- Returns:
- a CompletableFuture that completes when a response is received
from the server.
If authentication succeeded and the session principal has been changed, the CompletableFuture will complete successfully with a
TRUE
result.If authentication failed because the
principal
was unknown or thecredentials
were invalid, the session's principal has not changed and the CompletableFuture will complete successfully with aFALSE
result.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.
- Since:
- 6.0
-
getGlobalPermissions
CompletableFuture<Set<GlobalPermission>> getGlobalPermissions()Query the global permissions assigned to the calling session.- Returns:
- a CompletableFuture which completes when the response is received
from the server.
If the request was successful, the CompletableFuture will complete successfully with the session's global permissions.
- Since:
- 6.3
-
getPermissionsForPath
Query the path permissions assigned to the calling session on a given path.- Parameters:
path
- the path to query for permissions- Returns:
- a CompletableFuture which completes when the response is received
from the server.
If the request was successful, the CompletableFuture will complete successfully with the session's permissions for
path
. - Since:
- 6.5
-