Class ConditionEnforcementFilter

  • All Implemented Interfaces:
    org.forgerock.http.Filter

    public class ConditionEnforcementFilter
    extends Object
    implements org.forgerock.http.Filter
    An ConditionEnforcementFilter makes sure that the handled Request verifies a condition. If the condition is verified, the chain of execution continues. If the condition is not verified, it returns a 403 Forbidden response by default, that actually stops the chain or could refers to a failure handler.

    Configuration options:

     
     {
         "condition"              : expression,         [REQUIRED]
         "failureHandler          : handler             [OPTIONAL - default to 403]
     }
     
    
     
    For example:
     
     {
         "type": "ConditionEnforcementFilter",
         "config": {
             "condition"             : "${not empty(attributes.myAttribute)}",
             "failureHandler"        : "ConditionFailed"
         }
     }
     
     
    • Constructor Detail

      • ConditionEnforcementFilter

        public ConditionEnforcementFilter​(Expression<Boolean> condition,
                                          org.forgerock.http.Handler failureHandler)
        Parameters:
        condition - Expression that needs to evaluates to true to continue the chain of execution.
        failureHandler - The handler which will be invoked when condition fails.
    • Method Detail

      • filter

        public org.forgerock.util.promise.Promise<org.forgerock.http.protocol.Response,​org.forgerock.util.promise.NeverThrowsException> filter​(org.forgerock.services.context.Context context,
                                                                                                                                                     org.forgerock.http.protocol.Request request,
                                                                                                                                                     org.forgerock.http.Handler next)
        Specified by:
        filter in interface org.forgerock.http.Filter