OLD | NEW |
---|---|
(Empty) | |
1 <h2 id="usage">Implementing a Captive Portal Authenticator</h2> | |
2 This API allows an extension to implement an authenticator for captive portals. | |
not at google - send to devlin
2015/03/13 17:55:41
It's nice to try to use "Extension" not "extension
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
3 The interaction between extension, Chrome OS and the user will be: | |
not at google - send to devlin
2015/03/13 17:55:41
Try to use oxford commas, i.e. "Extension, Chrome
pneubeck (no reviews)
2015/03/17 10:27:02
it should be fine to use 'Chrome'. As long as the
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
4 <ul> | |
not at google - send to devlin
2015/03/13 17:55:41
Should this be an ordered list?
pneubeck (no reviews)
2015/03/17 10:27:03
Semantically these steps happen in order.
I just f
| |
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> | |
7 <li>If one of these networks is detected by Chrome OS, it will appear in the | |
8 network list, badged with an icon to indicate that a captive portal handler is | |
not at google - send to devlin
2015/03/13 17:55:40
"badged with an icon" --> "badged with your Extens
pneubeck (no reviews)
2015/03/17 10:27:03
As this highly debated about, I would not want to
| |
9 available.</li> | |
10 <li>If the user initiates a connection to such a network, Chrome OS will | |
11 connect as usual.</li> | |
not at google - send to devlin
2015/03/13 17:55:40
I find this point confusing, what does "as usual"
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
12 <li>If Chrome OS does not detect a captive portal, it will continue without | |
13 interacting with the extension.</li> | |
14 <li>If a captive portal is detected, the user is notified and asked whether | |
15 he wants to authenticate using the registered extension or whether he wants | |
not at google - send to devlin
2015/03/13 17:55:40
Avoid gender specific pronouns. In this case, you
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
16 to visit the captive portal page.</li> | |
17 <li>If he selects the extension, Chrome OS notifies the extension through | |
18 the $(ref:onCaptivePortalDetected) event.</li> | |
not at google - send to devlin
2015/03/13 17:55:40
and:
"If the user selects the extension..."
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
19 <li>The extension starts now any user interaction and network communication | |
20 that is required to authenticate at the captive portal. For that, other APIs | |
21 can be used as well.</li> | |
not at google - send to devlin
2015/03/13 17:55:40
I don't understand this point, perhaps it needs to
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
22 <li>Once the extension finished the authentication, it notifies the API using | |
23 $(ref:finishAuthentication) about its success or failure.</li> | |
24 </ul> | |
25 | |
not at google - send to devlin
2015/03/13 17:55:41
It would helpful to include a few screenshots in h
| |
26 <p> | |
27 In the extension, this can look similar to the following snippet: | |
28 </p> | |
29 | |
30 <pre data-filename="background.js"> | |
31 var myNetworks = [ | |
32 { Type: 'WiFi', SSID: 'MyHotSpot-1' }, | |
33 { Type: 'WiFi', SSID: 'MyHotSpot-2' } | |
34 ]; | |
35 | |
36 chrome.networking.config.setNetworkFilter(myNetworks, function() { | |
37 if (chrome.runtime.lastError) { | |
38 // Handle Error | |
39 } | |
40 }); | |
41 | |
42 chrome.networking.config.onCaptivePortalDetected.addListener( | |
43 function(networkInfo) { | |
44 var guid = networkInfo.GUID; | |
45 | |
46 // Check at first whether we really care about this network. | |
47 // This can look at additional network properties like BSSID that are not | |
48 // supported in the filter. | |
49 if (isBadNetwork(networkInfo)) { | |
50 chrome.networking.config.finishAuthentication(guid, 'unhandled'); | |
51 return; | |
52 } | |
53 checkForMyCaptivePortalServer(function(serverStatus) { | |
54 if (serverStatus == 'not-detected') { | |
55 chrome.networking.config.finishAuthentication(guid, 'unhandled'); | |
56 return; | |
57 } | |
58 if (serverStatus == 'error') { | |
59 chrome.networking.config.finishAuthentication(guid, 'failed'); | |
60 return; | |
61 } | |
62 | |
63 // If required, interact with the user. E.g. to register him on first | |
not at google - send to devlin
2015/03/13 17:55:40
s/him/them/
pneubeck (no reviews)
2015/03/17 10:27:02
Done.
| |
64 // usage. On subsequent authentications, cached credentials could be used. | |
65 ShowUIToRegisterUser(continueAuthentication.bind(null, guid)); | |
66 }); | |
67 }); | |
68 | |
69 function continueAuthentication(guid, credentials) { | |
70 if (!credentials) { | |
71 chrome.networking.config.finishAuthentication(guid, 'failed'); | |
72 } | |
73 AuthenticateToMyCaptivePortalServer(credentials, function(success) { | |
74 chrome.networking.config.finishAuthentication( | |
75 guid, success ? 'succeeded' : 'rejected'); | |
76 }); | |
77 } | |
78 </pre> | |
OLD | NEW |