com.hazelcast.security

## Interface SecurityContext

-     public interface SecurityContext

  SecurityContext is responsible for managing lifecycle of security object such as `ICredentialsFactory`, `IPermissionPolicy` etc, to creating `LoginContext`es for member and client authentications and checking permissions for client operations.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkPermission(Subject subject, Permission permission)` Checks whether current `Subject` has been granted specified permission or not.
    `LoginContext` | `createClientLoginContext(Credentials credentials)` Creates client `LoginContext`.
    `LoginContext` | `createMemberLoginContext(Credentials credentials)` Creates member `LoginContext`.
    `<V> SecureCallable<V>` | `createSecureCallable(Subject subject, Callable<V> callable)` Creates secure callable that runs in a sandbox.
    `void` | `destroy()` Destroys `SecurityContext` and all security elements.
    `ICredentialsFactory` | `getCredentialsFactory()` Returns current `ICredentialsFactory`.
    `void` | `interceptAfter(Credentials credentials, String serviceName, String objectName, String methodName)` intercepts a request after process if any `SecurityInterceptor` configured Any exception thrown during interception will be ignored
    `void` | `interceptBefore(Credentials credentials, String serviceName, String objectName, String methodName, Object[] parameters)` intercepts a request before process if any `SecurityInterceptor` configured
    `void` | `refreshPermissions(Set<PermissionConfig> permissionConfigs)`

- - ### Method Detail

    - #### createMemberLoginContext

          LoginContext createMemberLoginContext(Credentials credentials)
                                         throws LoginException

      Creates member `LoginContext`.
      Parameters:
        `credentials` - member credentials
      Returns:
        `LoginContext`
      Throws:
        `LoginException`

    - #### createClientLoginContext

          LoginContext createClientLoginContext(Credentials credentials)
                                         throws LoginException

      Creates client `LoginContext`.
      Parameters:
        `credentials` - client credentials
      Returns:
        `LoginContext`
      Throws:
        `LoginException`

    - #### getCredentialsFactory

          ICredentialsFactory getCredentialsFactory()

      Returns current `ICredentialsFactory`.
      Returns:
        `ICredentialsFactory`

    - #### checkPermission

          void checkPermission(Subject subject,
                               Permission permission)
                        throws AccessControlException

      Checks whether current `Subject` has been granted specified permission or not.
      Parameters:
        `subject` - the current subject
        `permission` - the specified permission for the subject
      Throws:
        `AccessControlException`

    - #### interceptBefore

          void interceptBefore(Credentials credentials,
                               String serviceName,
                               String objectName,
                               String methodName,
                               Object[] parameters)
                        throws AccessControlException

      intercepts a request before process if any `SecurityInterceptor` configured
      Parameters:
        `credentials` -
        `serviceName` -
        `objectName` -
        `methodName` -
        `parameters` -
      Throws:
        `AccessControlException`

    - #### interceptAfter

          void interceptAfter(Credentials credentials,
                              String serviceName,
                              String objectName,
                              String methodName)

      intercepts a request after process if any `SecurityInterceptor` configured Any exception thrown during interception will be ignored
      Parameters:
        `credentials` -
        `serviceName` -
        `objectName` -
        `methodName` -

    - #### createSecureCallable

          <V> SecureCallable<V> createSecureCallable(Subject subject,
                                                     Callable<V> callable)

      Creates secure callable that runs in a sandbox.
      Type Parameters:
        `V` - return type of callable
      Parameters:
        `subject` -
        `callable` -
      Returns:
        result of callable

    - #### destroy

          void destroy()

      Destroys `SecurityContext` and all security elements.

    - #### refreshPermissions

          void refreshPermissions(Set<PermissionConfig> permissionConfigs)

Copyright © 2019. All rights reserved.