AAA::auth_result

Description

This command is used to check whether the authentication information is sent successfully to IVS or not.

Syntax

AAA::auth_result <AAA request ID>

Examples

when HTTP_REQUEST_DATA {
  foreach p [split [HTTP::payload] &] {
    set key [URI::decode [getfield $p = 1]]
    set value [URI::decode [getfield $p = 2]]

    if { $key == "login" } {
      set username $value
    } elseif { $key == "password" } {
        set password $value
    } else {
        log local0. "ERROR: invalid input - ignoring"
    }
  }
  HTTP::release

  if { ![info exists username] || ![info exists password] } {
    log local0. "ERROR: username or password is not defined"
    return
  }

  log local0. "Sending radius auth request for $username"
  set request_id [AAA::auth_send radius_aaa_internal_vip $username $password]
  log local0. "request_id: $request_id"

  while { 1 } {
    set aaa_result [AAA::auth_result $request_id]
    if { $aaa_result == "INPROGRESS"  } {
      after 200
    } else {
        if { $aaa_result == "OK" } {
          set title   "Success"
          set msg     "Authentication successful"
          set code    200
        } else {
            set title   "Failure"
            set msg     "Authentication failed"
            set code    401
        }

        HTTP::respond $code content "
          <html>
           <head><title>$title</title></head>
           <body>$msg<body>
          </html>
          "
        break
    }
  }
}