Interface SecurityPolicy

    • Method Detail

      • support

        io.reactivex.Single<Boolean> support​(RequestExecutionContext ctx)
        Indicates whether the security policy can handle the request execution context or not. The policy can extract any information from the execution context to determine if the current request can be handled or not (ex: specific request header, body extraction, ...).
        Parameters:
        ctx - the current execution context that can be used to determine if this security policy can handle the current request execution or not.
        Returns:
        true if the policy can handle the current request execution, false otherwise.
      • requireSubscription

        default boolean requireSubscription()
        Security policy can be used together with a plan that requires a subscription. By enabling the subscription requirement, the gateway will automatically validate the subscription associated with the current request and reject the request if the subscription is invalid.
        Returns:
        true to indicates to check the subscription after the security policy has been successfully executed, false else.
      • onInvalidSubscription

        default io.reactivex.Completable onInvalidSubscription​(RequestExecutionContext ctx)
        Defines if the subscription associated must be checked and the action to execute when the subscription is not valid. Usually, it allows to the security policy to interrupt the execution with an error status code and some response headers. Returning null indicates that the subscription does have to be verified after the policy completes successfully.
        Returns:
        a Completable corresponding to the actions to execute when the gateway has detected an invalid subscription or null to disable subscription check.
      • order

        default int order()
        Defines the priority order of the security policy compared to others. By default, it is set to DEFAULT_ORDER. The lower is the order, the highest is the priority of the policy compared to other. The order is not guaranteed when 2 SecurityPolicy have the same order.
        Returns:
        the order of the security policy when multiple security policies can be involved.