I requisiti per stabilire un collegamento con External Portal Server (Omada SDN Controller 5.0.15)

User Application Requirement
Updated 01-17-2022 17:08:08 PM 48464
This Article Applies to: 

Per Omada Controller v4 (4.1.5 to 4.4.6) fai riferimento a FAQ 2907.

Per Omada Controller v3 fai riferimento a FAQ 2274.

 

Rispetto a Omada SDN Controller v4 le principali differenze sono:

1. Aggiunta del Controller ID all'URL per l'hotspot login e delle informazioni di sottoscrizione del client.

2. Aggiunta dell' HTTP header, che porta il CSRF Token.

 

Nota: le keywords in Bold Italics indicano parametri automaticamente impostati dall'EAP o dal Gateway e dovrebero essere correttamente identificate e consegnate dal server del tuo portale esterno. Il significato dei parametri è esplicitato alla prima comparsa.

 

Il documento specifica i requisiti necessari per stabilire il collegamento con il server di un portale web esterno. Per comprendere meglio i requisiti necessari a stabilire un External Web Portal, Portale, la seguente immagine illustra il workflow che intercorre tra client wireless, EAP, Omada Controller, Portale e Server di autenticazione, Server.

Steps 1 e 2.

Quando un client wireless o cablato è connesso alla SSID del network Wi-Fi o LAN e prova ad accedere a Internet, L'EAP o il gateway intercettano la richiesta HTTP del client reindirizzandola al Controller Omada SDN, insieme alle informazioni inserite automaticamente dall'EAP o dal Gateway nell'URL. 

 

Steps 3 e 4.

Il client invia richiesta HTTP GET con le informazioni di connessione al Controller e viene reindirizzao al Portale dalla risposta HTTP con codice 302 del Controller. La riposta HTTP include l'URL del Portale nel campo PORTAL insieme alle informazioni di connessione (maggiori dettagli sui contenuti dell'URL nello schema sotto riportato)

URL per EAP: http(s)://PORTAL?clientMac=CLIENT_MAC&apMac=AP_MAC&ssidName=SSID_NAME&t=TIME_SINCE_EPOCH&radioId=RADIO_ID&site=SITE_NAME&redirectUrl=LANDING_PAGE.

URL per Gateway: http(s)://PORTAL?clientMac=CLIENT_MAC&gatewayMac=GATEWAY_MAC&vid=VLAN_ID&t=TIME_SINCE_EPOCH&site=SITE_NAME&redirectUrl=LANDING_PAGE.

PORTAL

Indirizzo IP o URL e Port number (se necessario) del server del portale esterno.

clientMac

CLIENT_MAC

Indirizzo MAC del client.

apMac

AP_MAC

Indirizzo MAC dell'EAP a cui il client è connesso.

gatewayMac

GATEWAY_MAC

Indirizzo MAC del Gateway.

vid

VLAN_ID

VLAN ID del network cablato a cui è connesso il client.

ssidName

SSID_NAME

Nome dell'SSID a cui il client è connesso.

radioId

RADIO_ID

Radio ID della banda a cui il client è connesso in cui 0 rappresenta la banda 2.4G e 1 rappresenta la banda 5G.

site

SITE_NAME

Nome del sito.

redirectUrl

LANDING_PAGE

URL su cui reindirizzare l'utente una volta eseguita l'autenticazione, può essere impostata in Landing Page.

t

TIME_SINCE_EPOCH

In microsecondi.

 

       

 

Step 5 e 6.

Il client invierà la richiesta HTTP GET al Portale con l'URL che abbiamo visto sopra. Il Portale sarà in grado di riconoscere e mantenere le informazion idi connessione inserite nella query dell' HTTP GET e restituire la pagina web di autenticazione.

 

Step 7, 8, e 9.

Il Client invierà le informazioni di autenticazione al Portale che verranno consegnate direttamente al Server di autenticazione per essere verificate. Il Server invierà i risultati al Portale in risposta.

Puoi decidere come il Portale ottiene le informazioni di autenticazione dal client e come il Portale comunica con il Server di autenticazione in base alle tue necessità.

 

NOTA: nell'immagine sopra il Portale e il Server di autenticazione sono separati. Se lo desideri puoi installarli sullo stesso server. Anche la scelta del metodo di autenticazione dipende dalle tue necessità. Assicurati però che il Portale possa riconoscere i risultati dell'autenticazione trasmessi dal Server

 

Step 10 e 11.

Se la richiesta di autenticazione viene autorizzata, il Portale invierà le informazioni del Client al Controller richiamando la sua API.

Prima, deve accedere al Controller inviando una richiesta HTTP POST. L'URL della richiesta dovrebbe essere così composta https://CONTROLLER:PORT/CONTROLLER_ID/api/v2/hotspot/login e dovrebbe trasportare le inormazioni dell'account dell'operatore in formato JSON nell' HTTP message body: “name=OPERATOR_USERNAME&password=OPERATOR_PASSWORD.

Nota che l'account e la password qui sono quelle dell'operatore aggiunto all'interfaccia di management dell'hotspot, non i dati di accesso per  l'account del Controller

      

CONTROLLER

Indirizzo IP o URL di Omada SDN Controller.

PORT

Porta HTTPS per Controller Management di Omada SDN Controller (di default 8043 per il software e 433 per hardware controllert, vai in Settings --- Controller --- Access Config per modificarle).

CONTROLLER_ID

Identificativo di Omada SDN Controller. Quando accedi al controller l'identificativo sarà aggiunto automaticamente all'URL. Verifica L'URL per ottenere l'ID.

Ad esempio, se l'URL del tuo controller è https://localhost:8043/abcdefghijklmnopqrstuvwxyzabcdef/ allora il  CONTROLLER_ID è abcdefghijklmnopqrstuvwxyzabcdef.

OPERATOR_USERNAME

Username dell'operatore dell'hotspot.

OPERATOR_PASSWORD

Password dell'operatore dell'hotspot.

 

Codice Template PHP:

 

public static function login()

    {

        $loginInfo = array(

            "name" => OPERATOR_USER,

            "password" => OPERATOR_PASSWORD

        );

        $headers = array(

            "Content-Type: application/json",

            "Accept: application/json"

        );

        $ch = curl_init();

 

        // post

        curl_setopt($ch, CURLOPT_POST, TRUE);

 

        // Set return to a value, not return to page

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 

        // Set up cookies. COOKIE_FILE_PATH defines where to save Cookie.

        curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE_PATH);

        curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE_PATH);

 

        // Allow Self Signed Certs

        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

 

        // API Call

        curl_setopt($ch, CURLOPT_URL, "https://" . CONTROLLER . ":" . PORT . "/" . CONTROLLER_ID . "/api/v2/hotspot/login");

        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($loginInfo));

 

        $res = curl_exec($ch);

 

        $resObj = json_decode($res);

        //Prevent CSRF. TOKEN_FILE_PATH defines where to save Token.

        if ($resObj->errorCode == 0) {

            // login successfully

            self::setCSRFToken($resObj->result->token);

        }

        curl_close($ch);

    }

 

    private static function setCSRFToken($token)

    {

        $myfile = fopen(TOKEN_FILE_PATH, "w") or die("Unable to open file!");

        fwrite($myfile, $token);

        fclose($myfile);

        return $token;

    }

 

Se l'autenticazione va a buon fine, il Controller risponderà con il seguente JSON nell' HTTP body. Nota che il token inside result è CSRF-Token, che andrà aggiunto all' HTTP Header nei prossimi step.

{

    "errorCode": 0,

    "msg": "Hotspot log in successfully.",

    "result": {

        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

    }

}

 

Step 12 e 13.

Una volta completato il login con successo, il Portale può inviare il risultato di autenticazione al client https://CONTROLLER:PORT/CONTROLLER_ID/api/v2/hotspot/extPortal/auth con metodo HTTP POST.

Le informazioni del client devon oessere incapsulate in formato JSON e contenere i seguenti parametri.

Per EAP: “clientMac=CLIENT_MAC&apMac=AP_MAC&ssidName=SSID_NAME &radioId=RADIO_ID&site=SITE_NAME&time=EXPIRE_TIME&authType =4

Per Gateway: “clientMac=CLIENT_MAC&gatewayMac=GATEWAY_MAC&vid=VLAN_ID&site=SITE_NAME&time=EXPIRE_TIME&authType =4

 

 time

EXPIRE_TIME

Scadenza dell'autenticazione. Unità di tempo microsecondi.

 

PHP Code Template per EAP:

 

public static function authorize($clientMac, $apMac, $ssidName, $radioId, $milliseconds)

    {

        // Send user to authorize and the time allowed

        $authInfo = array(

            'clientMac' => $clientMac,

            'apMac' => $apMac,

            'ssidName' => $ssidName,

            'radioId' => $radioId,

            'time' => $milliseconds,

            'authType' => 4

        );

        $csrfToken = self::getCSRFToken();

        $headers = array(

            'Content-Type: application/json',

            'Accept: application/json',

            'Csrf-Token: ' . $csrfToken

        );

        $ch = curl_init();

        // post

        curl_setopt($ch, CURLOPT_POST, TRUE);

 

        // Set return to a value, not return to page

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 

        // Set up cookies.

        curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE_PATH);

        curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE_PATH);

 

        // Allow Self Signed Certs

        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

 

        // API Call

        curl_setopt($ch, CURLOPT_URL, "https://" . CONTROLLER . ":" . PORT . "/" . CONTROLLER_ID . "/api/v2/hotspot/login");

        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($authInfo));

        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        $res = curl_exec($ch);

        echo $res;

        $resObj = json_decode($res);

        if ($resObj->errorCode == 0) {

            // authorized successfully

        }

        curl_close($ch);

    }

 

    public static function getCSRFToken()

    {

        $myfile = fopen(TOKEN_FILE_PATH, "r") or die("Unable to open file!");

        $token = fgets($myfile);

        fclose($myfile);

        return $token;

    }

If the authentication request is accepted, the Controller will reply with the following JSON:

{

    "errorCode": 0

}

 

Nota: il Portale deve esere in grado di supportare i seguenti requisiti:

1. Consentire certificati Auto-Firmati. Oppure caricherai il tuo certificato HTTPS sul Controller.

2. Leggi e salva “TPEAP_SESSIONID” in Cookie e inviare richiesta di autenticazione con i Cookie.

 

Related FAQs

Looking for More

Questa faq è utile?

Your feedback helps improve this site.

Recommend Products

From United States?

Get products, events and services for your region.