Radiator Server Documentation — v10.33.2

with

Conditional execution block

Table of Contents
  • Syntax
  • Parameters
  • Example
  • Migration to until

NOTE: The until action should be used instead of the with action. The until action is a super set of the with action and provides a more flexible and powerful way to control pipeline execution.

The with block provides conditional execution of pipelines based on the result of a condition pipeline. It evaluates a condition and executes different pipelines depending on whether the condition succeeds or fails.

Syntax

with [pipeline directive] {
    # Condition pipeline - determines which branch to execute
    condition-actions...
} do {
    # Execute this pipeline if condition succeeds (returns true)
    success-actions...
} else {
    # Execute this pipeline if condition fails (returns false) - optional
    failure-actions...
}

Parameters

  • pipeline directive (optional): Pipeline directive for the condition block. Defaults to while
  • condition pipeline: Actions that determine the outcome
  • do pipeline: Actions executed when condition succeeds
  • else pipeline (optional): Actions executed when condition fails

Example

aaa {
    policy "DEFAULT" {
        handler "AUTHENTICATION" {
            execute {
                # Check if backend authentication succeeds
                with {
                    backend "LDAP_AUTH";
                } do {
                    # Backend authentication successful
                    accept "LDAP authentication successful";
                } else {
                    # Backend authentication failed
                    reject "LDAP authentication failed";
                }
            }
        }
    }
}

This example demonstrates using with to conditionally handle authentication based on a backend check. If the LDAP backend authentication succeeds, the user is accepted. If it fails, the user is rejected with an appropriate message.

Migration to until

Use until end {} with when clauses to replicate the do/else branches:

until end {
    backend "LDAP_AUTH";
} when accept {
    # Backend authentication successful
    accept "LDAP authentication successful";
} else {
    # Backend authentication failed
    reject "LDAP authentication failed";
}
Navigation
  • accept

  • all

  • any

  • append

  • assert

  • backend

  • challenge

  • chap

  • conditions

  • copy

  • count

  • debug

  • discard

  • each

  • eap

  • error

  • filter

  • first

  • hotp

  • http-basic-auth

  • if

  • ignore

  • invoke

  • log

  • map

  • message

  • modify

  • mschap

  • mschapv2

  • none

  • pap

  • reason

  • reject

  • reject_errors

  • replace

  • reply

  • rewrite

  • set

  • sleep

  • sometimes

  • stop

  • totp

  • trace

  • try

  • until

  • while

  • with

  • yubikey