Radiator Server Documentation — v10.34.2

map

match and map use the same value-matching syntax.

The map statement allows you to define conditional logic based on the value of a specified variable. It evaluates the given variable and executes the corresponding block of code that matches the variable's value.

Syntax

map <variable> {
    "<value1>" => {
        // actions for value1
    }
    "<value2>" => {
        // actions for value2
    }
    // additional value mappings...
}

Parameters

  • <variable> - The variable to evaluate and match against the defined values
  • <value> - String literals that represent possible values of the variable
  • Each block can contain assignments, if statements, and other pipeline actions

Example

aaa {
    policy "MANAGEMENT" {
        conditions all {
            aaa.protocol == protocol.MANAGEMENT;
        }

        handler "AUTHENTICATION" {
            @authentication {
                http_management_authentication {
                    @resolve {
                        map user.backend {
                            "USERS_INTERNAL_FILE" => {
                                user.privilege = "write";
                            }
                            "LDAP" => {
                                if all {
                                    user.group == "administrators";
                                } then {
                                    user.privilege = "write";
                                }
                            }
                            any => {
                                user.privilege = "read";
                            }
                        }
                    }

                    @verify {
                        http_basic_auth;
                    }
                }
            }
        }
    }
}