| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Third party authentication support for the remoting web-app. | 7 * Third party authentication support for the remoting web-app. |
| 8 * | 8 * |
| 9 * When third party authentication is being used, the client must request both a | 9 * When third party authentication is being used, the client must request both a |
| 10 * token and a shared secret from a third-party server. The server can then | 10 * token and a shared secret from a third-party server. The server can then |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 tokenUrl, hostPublicKey, scope, tokenUrlPatterns, | 38 tokenUrl, hostPublicKey, scope, tokenUrlPatterns, |
| 39 onThirdPartyTokenFetched) { | 39 onThirdPartyTokenFetched) { |
| 40 this.tokenUrl_ = tokenUrl; | 40 this.tokenUrl_ = tokenUrl; |
| 41 this.tokenScope_ = scope; | 41 this.tokenScope_ = scope; |
| 42 this.onThirdPartyTokenFetched_ = onThirdPartyTokenFetched; | 42 this.onThirdPartyTokenFetched_ = onThirdPartyTokenFetched; |
| 43 this.failFetchToken_ = function() { onThirdPartyTokenFetched('', ''); }; | 43 this.failFetchToken_ = function() { onThirdPartyTokenFetched('', ''); }; |
| 44 this.xsrfToken_ = base.generateXsrfToken(); | 44 this.xsrfToken_ = base.generateXsrfToken(); |
| 45 this.tokenUrlPatterns_ = tokenUrlPatterns; | 45 this.tokenUrlPatterns_ = tokenUrlPatterns; |
| 46 this.hostPublicKey_ = hostPublicKey; | 46 this.hostPublicKey_ = hostPublicKey; |
| 47 if (chrome.identity) { | 47 if (chrome.identity) { |
| 48 /** @type {function():void} | 48 /** @private {function():void} */ |
| 49 * @private */ | |
| 50 this.fetchTokenInternal_ = this.fetchTokenIdentityApi_.bind(this); | 49 this.fetchTokenInternal_ = this.fetchTokenIdentityApi_.bind(this); |
| 51 this.redirectUri_ = 'https://' + window.location.hostname + | 50 this.redirectUri_ = 'https://' + window.location.hostname + |
| 52 '.chromiumapp.org/ThirdPartyAuth'; | 51 '.chromiumapp.org/ThirdPartyAuth'; |
| 53 } else { | 52 } else { |
| 54 this.fetchTokenInternal_ = this.fetchTokenWindowOpen_.bind(this); | 53 this.fetchTokenInternal_ = this.fetchTokenWindowOpen_.bind(this); |
| 55 this.redirectUri_ = remoting.settings.THIRD_PARTY_AUTH_REDIRECT_URI; | 54 this.redirectUri_ = remoting.settings.THIRD_PARTY_AUTH_REDIRECT_URI; |
| 56 } | 55 } |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 /** | 58 /** |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 /** | 168 /** |
| 170 * Fetch a token from a token server using the identity.launchWebAuthFlow API. | 169 * Fetch a token from a token server using the identity.launchWebAuthFlow API. |
| 171 * @private | 170 * @private |
| 172 */ | 171 */ |
| 173 remoting.ThirdPartyTokenFetcher.prototype.fetchTokenIdentityApi_ = function() { | 172 remoting.ThirdPartyTokenFetcher.prototype.fetchTokenIdentityApi_ = function() { |
| 174 var fullTokenUrl = this.getFullTokenUrl_(); | 173 var fullTokenUrl = this.getFullTokenUrl_(); |
| 175 chrome.identity.launchWebAuthFlow( | 174 chrome.identity.launchWebAuthFlow( |
| 176 {'url': fullTokenUrl, 'interactive': true}, | 175 {'url': fullTokenUrl, 'interactive': true}, |
| 177 this.parseRedirectUrl_.bind(this)); | 176 this.parseRedirectUrl_.bind(this)); |
| 178 }; | 177 }; |
| OLD | NEW |