Deployment Guide

Table Of Contents
login.php
<?php
// login.php
// This is a simple implementation of a script that
// receives a user's credentials, authenticates the
// credentials, selects an access control role for
// the user, then redirects the user back to the
// controller using a signed URL containing the selected
// access control role.
// This script assumes that the credentials are
// submitted on the form created by the example script
// net-auth.php.
//
//
// Assumptions
// ===========
// 1. The controller is configured to include its IP address
// and port in the redirection URL and the submitted login
// form contains that IP address and port. This allows the
// ECP to interact with more than one controller.
// 2. Whether the script uses HTTP or HTTPS in its redirection
// response depends on the value of use_https,
// which must be defined in php.ini.
// If the value of use_https is 1, then the script uses
// HTTPS. If the configuration variable has any other value
// or is not defined, then the script uses HTTP. In practice,
// an actual site is going to settle on using HTTP or HTTPS.
// The scripts can then assume that method is being used
// rather than looking up the method in php.ini.
// The use_https is a user-
// defined variable. It must be created in php.ini by the
// web server administrator.
require_once("ffecp_config.php");
require_once("crypt_aws_s4.php");
require_once("common_utilities.php");
// Some local constants
const EWC_HTTP_REQ = "http://";
const EWC_HTTPS_REQ = "https://";
const EWC_REDIRECT_TARGET = "/ext_approval.php?";
// The mainline begins here. The utilities are defined after the
// mainline.
// 1. Collect the parameters submitted on the login form.
// Some of these attributes come from hidden fields.
$hwc_ip = trim($_REQUEST['hwc_ip']);
$hwc_port = trim($_REQUEST['hwc_port']);
$dest = trim($_REQUEST['dest']);
$token = trim($_REQUEST['token']);
$username = (isset($_REQUEST['userid'])) ?
trim($_REQUEST['userid']) : "";
$passwd = (isset($_REQUEST['passwd'])) ?
trim($_REQUEST['passwd']) : "";
$wlan = isset($_REQUEST['wlan']) ?
trim($_REQUEST['wlan']) : "";
if(!tokenCheck($token)) {
printError("Error: <span style='color:red'>Failed to process the request: incorrect
token.</span>");
exit;
} else if(isset($hwc_port) && !is_numeric($hwc_port)) {
printError("Error: <span style='color:red'>Failed to process the request: incorrect
port.</span>");
exit;
} else if(!empty($wlan) && !is_numeric($wlan)) {
printError("Error: <span style='color:red'>Failed to process the request: incorrect
PHP External Captive Portal, Controller’s Firewall
Friendly API login.php
Extreme Campus Controller Deployment Guide for version 5.46.03 201