How do you apply Steps in Preflow context based on conditions

eadams
New Member

I am trying to only apply a set of rules in a preflow rule conditionally. Basically i only want these steps to be taken if the request.header.authorization is set to a Bearer variety. We have several different authotization contexts for historical reasons and want to handle Basic auth differently than Bearer auth. What is the most effective way of handling this?

<Request>
  <Condition>request.header.authorization Matches "Bearer*" </Condition>
  <Step>
    <Name>Auth-Proxy</Name>
  </Step>
  <Step>
    <Name>Auth-Target</Name>
  </Step>
</Request>
Solved Solved
0 2 172
1 ACCEPTED SOLUTION

There is no direct way to apply a condition to a set of steps. You have a couple options.

  1. repeat the condition in each of several distinct steps
    <Request>
      <Step>
        <Condition>request.header.authorization Matches "Bearer*" </Condition>
        <Name>Auth-Proxy</Name>
      </Step>
      <Step>
        <Condition>request.header.authorization Matches "Bearer*" </Condition>
        <Name>Auth-Target</Name>
      </Step>
    </Request>
  2. extract the series of steps into a flowcallout and wrap the condition around THAT single step
    <Request>
      <Step>
        <Condition>request.header.authorization Matches "Bearer*" </Condition>
        <Name>FC-Auth</Name>
      </Step>
    </Request>

View solution in original post

2 REPLIES 2

There is no direct way to apply a condition to a set of steps. You have a couple options.

  1. repeat the condition in each of several distinct steps
    <Request>
      <Step>
        <Condition>request.header.authorization Matches "Bearer*" </Condition>
        <Name>Auth-Proxy</Name>
      </Step>
      <Step>
        <Condition>request.header.authorization Matches "Bearer*" </Condition>
        <Name>Auth-Target</Name>
      </Step>
    </Request>
  2. extract the series of steps into a flowcallout and wrap the condition around THAT single step
    <Request>
      <Step>
        <Condition>request.header.authorization Matches "Bearer*" </Condition>
        <Name>FC-Auth</Name>
      </Step>
    </Request>

Not what i was hoping, but it works as expected. Thank you!