Interface Security

All Superinterfaces:
Feature

public interface Security extends Feature
This feature provides a client session with the ability to re-authenticate the session, as well as to query permissions assigned to it.

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 a session as follows:
 
 Security security = session.feature(Security.class);
 
 
Since:
5.0
Author:
DiffusionData Limited
  • 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 using Session.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 principal
      properties - 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, an empty 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 the credentials were invalid, the session will not have been re-authenticated and the CompletableFuture will complete successfully with a FALSE result.

      Otherwise, the CompletableFuture will complete exceptionally with a CompletionException. Common reasons for failure, listed by the exception reported as the cause, include:

      Since:
      6.12
    • changePrincipal

      @Deprecated default CompletableFuture<Boolean> changePrincipal(String principal, Credentials credentials)
      Deprecated.
      since 6.12

      Use 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 name
      credentials - 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 the credentials were invalid, the session's principal has not changed and the CompletableFuture will complete successfully with a FALSE result.

      Otherwise, the CompletableFuture will complete exceptionally with a CompletionException. Common reasons for failure, listed by the exception reported as the cause, include:

      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

      CompletableFuture<Set<PathPermission>> getPermissionsForPath(String path)
      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