Interface SecurityService

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable

    public interface SecurityService
    extends java.io.Closeable
    Responsible for performing any security validations on the Rest request and response. Validations could involve authentication, authorization, security checks and so on which the implementation can decide. This could also involve setting headers while responding, based on the request. Exceptions are returned via Callbacks on any validation failure.
    • Method Detail

      • preProcessRequest

        void preProcessRequest​(RestRequest restRequest,
                               Callback<java.lang.Void> callback)
        Performs security validations (if any) before any processing of the restRequest begins and invokes the callback once done.
        Parameters:
        restRequest - the RestRequest to process.
        callback - the callback to invoke once processing is finished.
      • processRequest

        void processRequest​(RestRequest restRequest,
                            Callback<java.lang.Void> callback)
        Performs security validations (if any) on the RestRequest asynchronously and invokes the Callback when the validation completes.
        Parameters:
        restRequest - RestRequest upon which validations has to be performed
        callback - The Callback which will be invoked on the completion of the request. Cannot be null.
      • postProcessRequest

        void postProcessRequest​(RestRequest restRequest,
                                Callback<java.lang.Void> callback)
        Performs security validations (if any) on the RestRequest when it has been fully parsed. That is, when the RestRequest has been annotated with any additional arguments (like account and container). Invokes the Callback when the validation is complete.
        Parameters:
        restRequest - RestRequest upon which validations has to be performed
        callback - The Callback which will be invoked on the completion of the request. Cannot be null.
      • processResponse

        void processResponse​(RestRequest restRequest,
                             RestResponseChannel responseChannel,
                             BlobInfo blobInfo,
                             Callback<java.lang.Void> callback)
        Performs security validations (if any) on the response for RestRequest asynchronously, sets headers if need be and invokes the Callback when the validation completes. Similar to processRequest(RestRequest, Callback), validations could involve security checks and setting some headers with the response.
        Parameters:
        restRequest - RestRequest whose response have to be validated
        responseChannel - the RestResponseChannel over which the response is sent
        blobInfo - the BlobInfo pertaining to the rest request made
        callback - The Callback which will be invoked on the completion of the request. Cannot be null.
      • preProcessRequest

        default java.util.concurrent.Future<java.lang.Void> preProcessRequest​(RestRequest restRequest)
        Similar to preProcessRequest(RestRequest, Callback) but returns a Future instead of requiring a callback.
        Parameters:
        restRequest - RestRequest upon which validations has to be performed
        Returns:
        a Future that is completed when the pre-processing is done.
      • processRequest

        default java.util.concurrent.Future<java.lang.Void> processRequest​(RestRequest restRequest)
        Similar to processRequest(RestRequest, Callback) but returns a Future instead of requiring a callback.
        Parameters:
        restRequest - RestRequest upon which validations has to be performed
        Returns:
        a Future that is completed when the processing is done.
      • postProcessRequest

        default java.util.concurrent.Future<java.lang.Void> postProcessRequest​(RestRequest restRequest)
        Similar to postProcessRequest(RestRequest, Callback) but returns a Future instead of requiring a callback.
        Parameters:
        restRequest - RestRequest upon which validations has to be performed
        Returns:
        a Future that is completed when the post-processing is done.