ゲスト アクセスに外部ポータルを使用する(Use an External Portal for Guest Access)
Web 開発者が自分の Web サイトで設計したサインイン ポータルにゲストがアクセスできるようにする場合は、外部ポータルを有効にします。
外部ポータルは、WLAN ユーザーが SSID を選択した後に表示される Web ページです。たとえば、会社のホーム ページや、Web 開発者が組織専用に設定したサインイン ポータルにゲストを送信できます。
セキュリティを強化するために、許可されたユーザー、許可されたサブネット、および許可されたホスト名を指定できます。また、ブロックするホスト名のリストを入力することもできます。
- WLANに移動します。
手記:
-
WLAN が WLAN テンプレートに含まれている場合は、[ Organization > Wireless |[WLAN テンプレート(WLAN Templates)] をクリックし、テンプレートをクリックしてから [WLAN] をクリックします。
-
サイトレベルの WLAN の場合は、[ Site > Wireless |[WLANs] をクリックし、をクリックします。
-
- [Edit WLAN] ウィンドウの [Guest Portal] で、[Forward to external portal] をクリックします。
- (オプション)特定のユーザにアクセスを制限する場合は、[ゲスト認証の編集(Edit Guest Authorization)] ボタンをクリックします。次に、次の手順を実行します。
- [Authorized Guests] ウィンドウで、[Add] をクリックします。
- [ゲストの承認(Authorize Guest)] ウィンドウで、ゲストの MAC アドレス(必須)、オプションのユーザ情報、およびユーザが認証されたままになる期間を入力します。
手記:[ Search Client ] オプションを使用すると、WLAN にすでに接続されているクライアントを検索できます。
- [Authorize Guest] ウィンドウの下部にある [Authorize] をクリックします。
- これらの手順を繰り返して、リストにゲストを追加します。
- [Authorized Guests] ウィンドウで、[Add] をクリックします。
- ポータルの URL を http:// または https:// で始まるように入力します。
手記:
他のフィールドを使用して、アクセスを微調整します。たとえば、特定のサブネットやホスト名のみを許可します。
- [例外の場合にゲスト/外部ポータルをバイパスする] チェック ボックスをオンまたはオフにします。
この機能を選択すると、各アクセス ポイントはポータルまたは IdP に到達しようとしますが、到達できない場合、AP はゲストに WLAN への接続を自動的に承認します。
- [Edit WLAN] ウィンドウの下部にある [Save] をクリックします。
PHP ファイルと Read-Me ファイルを使用した外部ポータルの作成
- 以下のサンプル PHP ファイルおよび読み取り情報を参照して、外部ポータルを作成します。
index.php
<?php /* These parameters are sent by Mist on the 302 redirect to this portal page: wlan_id - WLAN object's UUID ap_mac - MAC address of the AP client_mac - MAC address of the client device url - Originally requested url by the client, ie: http://www.mist.com ap_name - Name of the AP site_name - Name of the Site If you want to send the guest to a content page after authorization, configure the $url instead of using the valued that is passed as a parameter. */ $wlan_id = $_GET['wlan_id']; $ap_mac = $_GET['ap_mac']; $client_mac = $_GET['client_mac']; $url = $_GET['url']; $ap_name = $_GET['ap_name']; $site_name = $_GET['site_name']; ?> <html> <body> <form action="authme.php" method="post"> <input type="hidden" name="wlan_id" value="<?php echo($wlan_id) ?>" /> <input type="hidden" name="ap_mac" value="<?php echo($ap_mac) ?>" /> <input type="hidden" name="client_mac" value="<?php echo($client_mac) ?>" /> <input type="hidden" name="url" value="<?php echo($url) ?>" /> <input type="hidden" name="ap_name" value="<?php echo($ap_name) ?>" /> <input type="hidden" name="site_name" value="<?php echo($site_name) ?>" /> <table> <tr> <td><b>Your Full Name</b></td> <td><input type="text" name="name" /></td> </tr> <tr> <td><b>Your Email Address</b></td> <td><input type="text" name="email" /></td> </tr> <tr> <td><input type="submit" value="Login" /></td> </tr> </table> </form> </body> </html>
authme.php<?php $secret = ''; // WLAN API Key, obtained from the Mist Web GUI after creating the WLAN $wlan_id = $_POST['wlan_id']; $ap_mac = $_POST['ap_mac']; $client_mac = $_POST['client_mac']; $url = $_POST['url']; $ap_name = $_POST['ap_name']; $site_name = $_POST['site_name']; $authorize_min = 525600; // Duration (in minutes) the guest MAC address is authorized before they are redirected back to the portal page) $context = sprintf('%s/%s/%s/%d/%d/%d/%d', $wlan_id, $ap_mac, $client_mac, $authorize_min, ); $token = urlencode(base64_encode($context)); // The below portal fields are passed back to Mist and shown in the Guest Portal Information $name = $_POST['name']; $email = $_POST['email']; $field1 = 'Whatever you want Custom field 1 to be'; $field2 = 'Whatever you want Custom field 2 to be'; $field3 = 'Whatever you want Custom field 3 to be'; $field4 = 'Whatever you want Custom field 4 to be'; $forward = urlencode($url); // URL the user is forwarded to after authorization $extra = '&forward=' . $forward; $extra .= '&name=' . urlencode("$name"); $extra .= '&field1=' . urlencode("$field1"); $extra .= '&field2=' . urlencode("$field2"); $extra .= '&field3=' . urlencode("$field3"); $extra .= '&field4=' . urlencode("$field4"); $extra .= '&email=' . urlencode("$email"); $expires = time() + 120; // The time until which the authorization URL is valid $payload = sprintf('expires=%d&token=%s%s', $expires, $token, $extra); $signature = urlencode(base64_encode(hash_hmac('sha1', $payload, $secret, true))); $final_url = sprintf('http://portal.mist.com/authorize?signature=%s&%s', $signature, $payload); /* Debug code used for testing purposes only If set to true, display the variable details without authorizing the guest in the Mist cloud */ $debugging = false; if ($debugging) { header('Content-Type: text/plain'); echo sprintf('token : urlencode(base64(%s))', $context) . PHP_EOL; echo sprintf(' %s', $token) . PHP_EOL; echo sprintf('foward : %s', $url) . PHP_EOL; echo sprintf(' %s', $foward) . PHP_EOL; echo sprintf('payload-to-sign: %s', $payload) . PHP_EOL; echo sprintf('signature : %s', $signature) . PHP_EOL; echo sprintf('URL : %s', $final_url) . PHP_EOL; echo sprintf('client_mac : %s', $client_mac) . PHP_EOL; echo sprintf('ap_mac : %s', $ap_mac) . PHP_EOL; echo sprintf('ap_name : %s', $ap_name) . PHP_EOL; echo sprintf('wlan_id : %s', $wlan_id) . PHP_EOL; echo sprintf('site_name : %s', $site_name) . PHP_EOL; echo sprintf('name : %s', $name) . PHP_EOL; echo sprintf('email : %s', $email) . PHP_EOL; echo sprintf('field1 : %s', $field1) . PHP_EOL; echo sprintf('field2 : %s', $field2) . PHP_EOL; echo sprintf('field3 : %s', $field3) . PHP_EOL; echo sprintf('field4 : %s', $field4) . PHP_EOL; } else { // Guest is redirected to the Mist portal for authorization. If successful, the Mist portal will then redirect the guest to the $url header('Location: ' . $final_url); } ?>Read-Me InformationThis sample code shows how to use the PHP POST method to pass the below parameter values from the landing page (index.php) to the authorization page (authme.php). The authorization page will also request the user to provide some information. Authorization HOW-TOs ===================== Syntax: signature=<signature>&expires=<epoch-seconds>&token=<token>&forward=<forward> Note: Wired captive portal does not support this mechanism, please use the JWT based one. <forward>: url to forward the user to after authorization <token>: base64("wlan-id/ap-mac/client-mac/authorize_min/0/0/0") <signature>: base64(hmac_sha1(<secret>, "expires=...")) Example token : urlencode(base64("be22bba7-8e22-e1cf-5185-b880816fe2cf/5c5b35001234/d58f6bb4c9d8/480/0/0/0")) = YmUyMmJiYTctOGUyMi1lMWNmLTUxODUtYjg4MDgxNmZlMmNmLzVjNWIzNTAwMTIzNC9kNThmNmJiNGM5ZDgvNDgwLzAvMC8w expires : 1768587994 forward : urlencode("http://www.mist.com") http%3A%2F%2Fwww.mist.com%2F payload-to-sign: expires=1768587994&token=YmUyMmJiYTctOGUyMi1lMWNmLTUxODUtYjg4MDgxNmZlMmNmLzVjNWIzNTAwMTIzNC9kNThmNmJiNGM5ZDgvNDgwLzAvMC8w&forward=http%3A%2F%2Fwww.mist.com%2F secret : test-secret (only used by /authorize-test for testing purpose) signature : J7VJlf2Zlcs%2BOxhVxCf8hL0XYC0%3D final URL : http://portal.mist.com/authorize-test?signature=J7VJlf2Zlcs%2BOxhVxCf8hL0XYC0%3D&expires=1768587994&token=YmUyMmJiYTctOGUyMi1lMWNmLTUxODUtYjg4MDgxNmZlMmNmLzVjNWIzNTAwMTIzNC9kNThmNmJiNGM5ZDgvNDgwLzAvMC8w&forward=http%3A%2F%2Fwww.mist.com%2F Alternatively, you can use JWT tokens: Syntax: jwt=<jwt token> Payload: { "ap_mac": "5c5b35001234", "wlan_id": "be22bba7-8e22-e1cf-5185-b880816fe2cf", "client_mac": "d58f6bb4c9d8", "minutes": 480, "expires": 1768587994, "forward": "http://www.mist.com", "authorize_only": false } Notes: authorize_only: if true and authorization is successful, 200 OK will be returned instead of 302 Redirect the user to the `forward` URL Example ``` import jwt secret = "test-secret" payload = { "ap_mac": "5c5b35001234", "wlan_id": "be22bba7-8e22-e1cf-5185-b880816fe2cf", # only for _wireless_ captive portal "site_id": "ce22bba7-8e22-e1cf-5185-b880816fe2ce", # only for _wired_ captive portal" "port_name": "eth0", # only for _wired_ captive portal" "client_mac": "d58f6bb4c9d8", "minutes": 480, "expires": 1768587994, "forward": "http://www.mist.com", "authorize_only": False } encoded_jwt = jwt.encode(payload, secret, algorithm='HS256') ``` encoded_jwt: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVfb25seSI6ZmFsc2UsImV4cGlyZXMiOjE3Njg1ODc5OTQsImFwX21hYyI6IjVjNWIzNTAwMTIzNCIsImZvcndhcmQiOiJodHRwOi8vd3d3Lm1pc3QuY29tIiwiY2xpZW50X21hYyI6ImQ1OGY2YmI0YzlkOCIsIm1pbnV0ZXMiOjQ4MCwid2xhbl9pZCI6ImJlMjJiYmE3LThlMjItZTFjZi01MTg1LWI4ODA4MTZmZTJjZiJ9.msBloHe05XzbzaMEqjsi8XSNWa_3uc--4wucKz3dQGk final URL : http://portal.mist.com/authorize-test?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVfb25seSI6ZmFsc2UsImV4cGlyZXMiOjE3Njg1ODc5OTQsImFwX21hYyI6IjVjNWIzNTAwMTIzNCIsImZvcndhcmQiOiJodHRwOi8vd3d3Lm1pc3QuY29tIiwiY2xpZW50X21hYyI6ImQ1OGY2YmI0YzlkOCIsIm1pbnV0ZXMiOjQ4MCwid2xhbl9pZCI6ImJlMjJiYmE3LThlMjItZTFjZi01MTg1LWI4ODA4MTZmZTJjZiJ9.msBloHe05XzbzaMEqjsi8XSNWa_3uc--4wucKz3dQGk手記:portal.mist.comを、Mist組織を作成したクラウド インスタンスに基づく適切なゲスト Wi-Fi ポータル URL に置き換えます。お住まいの地域のゲスト Wi-Fi ポータルの URL を検索するには、Juniper Mist 管理ガイドの「Mist Cloud IP アドレスとポート」の情報を参照してください。 - auth.phpの
$secretに必要な値を取得するには、[Edit WLAN] ウィンドウを再度開き、[API Secret] をコピーします。 - 認証ページ (authme.php) を構成して、必要なクエリ文字列パラメーターを使用して Juniper Mist バックエンドを呼び出します。
?signature=signature&expires=expires&token=token&optional-
expires – 認証 URL が有効になるまでのエポックタイムスタンプ。
-
例: 1768587994 (これは、認証 URL が 2026 年 1 月 16 日午後 6 時 26 分 34 秒 (UTC) に期限切れになることを意味します。
-
-
token – 形式が wlan_id/ap_mac/client_mac/authorize_min/0/0/0 の base64 文字列
-
例:be22bba7-8e22-e1cf-5185-b880816fe2cf/5c5b35001234/d58f6bb4c9d8/480/0/0/0
-
-
signature – ハッシュアルゴリズムとして sha1 を使用し、キーとしてゲスト WLAN の API シークレットを使用した、ハッシュ値の base64 文字列。これは、expires=expires&token=token&optional という形式になります。
-
例:J7VJlf2Zlcs%2BOxhVxCf8hL0XYC0%3D
-
-
optional – オプションのゲストの詳細と、承認後にユーザーが転送される URL (次の形式) forward=url&name=name&email=email&company=company&field1=field1&field2=field2&field3=field3&field4=field4
注: すべてのパラメーター値が base64 として渡されていることを確認してください。
-
たとえば、forward=http%3A%2F%2Fwww.mist.com%2F です。
-
-
- ゲスト承認のために Juniper Mist を呼び出すように承認ページを構成します。最終的な認証 URL は、
http://portal.mist.com/authorize?signature=J7VJlf2Zlcs%2BOxhVxCf8hL0XYC0%3D&expires=1768587994&token=YmUyMmJiYTctOGUyMi1lMWNmLTUxODUtYjg4MDgxNmZlMmNmLzVjNWIzNTAwMTIzNC9kNThmNmJiNGM5ZDgvNDgwLzAvMC8w&forward=http%3A%2F%2Fwww.mist.com%2Fのようになります。 - デバイスに接続して認証を試みることで、外部キャプティブポータルをテストします。
デバイスは、認証のためにJuniper Mistポータルにリダイレクトされる必要があります。認証が成功すると、ユーザーは外部キャプティブポータルコードで定義されたURLにリダイレクトされます。
手記:ライブポータルには
/authorizeを使用します。テスト目的では、/authorize-testを使用できます。これには、Read-Me Informationで提供されているダミーの例値が必要です。