OLD | NEW |
1 <h2 id="usage">Implementing a Captive Portal Authenticator</h2> | 1 <h2 id="usage">Implementing a Captive Portal Authenticator</h2> |
2 This API allows an Extension to implement an authenticator for captive portals. | 2 This API allows an Extension to implement an authenticator for captive portals. |
3 The interaction between Extension, Chrome, and the user will be: | 3 The interaction between Extension, Chrome, and the user will be: |
4 <ol> | 4 <ol> |
5 <li>Using $(ref:setNetworkFilter), the Extension registers for a list of Wi-Fi | 5 <li>Using $(ref:setNetworkFilter), the Extension registers for a list of Wi-Fi |
6 networks that it wants to handle captive portals on.</li> | 6 networks that it wants to handle captive portals on.</li> |
7 <li>If one of these networks is detected by Chrome, it will appear in the | 7 <li>If one of these networks is detected by Chrome, it will appear in the |
8 network list, badged with an icon to indicate that a captive portal handler is | 8 network list, badged with an icon to indicate that a captive portal handler is |
9 available.</li> | 9 available. |
| 10 <p> |
| 11 <img src="{{static}}/images/networking_config_badge.png" |
| 12 align="middle" width="301" height="305" alt="Badge icon in tray network lis
t" /> |
| 13 </li> |
10 <li>If the user selects such a network, but a captive portal is not detected, | 14 <li>If the user selects such a network, but a captive portal is not detected, |
11 Chrome will connect as usual - the Extension will never be involved.</li> | 15 Chrome will connect as usual - the Extension will never be involved.</li> |
12 <li>Otherwise, if a captive portal is detected, the user is notified and asked | 16 <li>Otherwise, if a captive portal is detected, the user is notified and asked |
13 to authenticate using the registered Extension or whether to visit the captive | 17 to authenticate using the registered Extension or whether to visit the captive |
14 portal page.</li> | 18 portal page. |
| 19 <p> |
| 20 <img src="{{static}}/images/networking_config_notification.png" |
| 21 align="middle" width="367" height="224" alt="Captive portal notification" /
> |
| 22 </li> |
15 <li>If the user selects the Extension, Chrome notifies the Extension through | 23 <li>If the user selects the Extension, Chrome notifies the Extension through |
16 the $(ref:onCaptivePortalDetected) event.</li> | 24 the $(ref:onCaptivePortalDetected) event.</li> |
17 <li>The Extension should now interact with the user if necessary and | 25 <li>The Extension should now interact with the user if necessary and |
18 authenticate at the captive portal.</li> | 26 authenticate at the captive portal.</li> |
19 <li>Once the Extension finished the authentication, it notifies the API using | 27 <li>Once the Extension finished the authentication, it notifies the API using |
20 $(ref:finishAuthentication) about its success or failure.</li> | 28 $(ref:finishAuthentication) about its success or failure.</li> |
21 </ol> | 29 </ol> |
22 | 30 |
23 <p> | 31 <p> |
24 In the Extension, this can look similar to the following snippet: | 32 In the Extension, this can look similar to the following snippet: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 function continueAuthentication(guid, credentials) { | 74 function continueAuthentication(guid, credentials) { |
67 if (!credentials) { | 75 if (!credentials) { |
68 chrome.networking.config.finishAuthentication(guid, 'failed'); | 76 chrome.networking.config.finishAuthentication(guid, 'failed'); |
69 } | 77 } |
70 AuthenticateToMyCaptivePortalServer(credentials, function(success) { | 78 AuthenticateToMyCaptivePortalServer(credentials, function(success) { |
71 chrome.networking.config.finishAuthentication( | 79 chrome.networking.config.finishAuthentication( |
72 guid, success ? 'succeeded' : 'rejected'); | 80 guid, success ? 'succeeded' : 'rejected'); |
73 }); | 81 }); |
74 } | 82 } |
75 </pre> | 83 </pre> |
OLD | NEW |