| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 this.onThirdPartyTokenFetched_(token, sharedSecret); | 125 this.onThirdPartyTokenFetched_(token, sharedSecret); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * Build a full token request URL from the parameters in this object. | 129 * Build a full token request URL from the parameters in this object. |
| 130 * | 130 * |
| 131 * @return {string} Full URL to request a token. | 131 * @return {string} Full URL to request a token. |
| 132 * @private | 132 * @private |
| 133 */ | 133 */ |
| 134 remoting.ThirdPartyTokenFetcher.prototype.getFullTokenUrl_ = function() { | 134 remoting.ThirdPartyTokenFetcher.prototype.getFullTokenUrl_ = function() { |
| 135 return this.tokenUrl_ + '?' + remoting.xhr.urlencodeParamHash({ | 135 return this.tokenUrl_ + '?' + remoting.Xhr.urlencodeParamHash({ |
| 136 'redirect_uri': this.redirectUri_, | 136 'redirect_uri': this.redirectUri_, |
| 137 'scope': this.tokenScope_, | 137 'scope': this.tokenScope_, |
| 138 'client_id': this.hostPublicKey_, | 138 'client_id': this.hostPublicKey_, |
| 139 // The webapp uses an "implicit" OAuth flow with multiple response types to | 139 // The webapp uses an "implicit" OAuth flow with multiple response types to |
| 140 // obtain both the code and the shared secret in a single request. | 140 // obtain both the code and the shared secret in a single request. |
| 141 'response_type': 'code token', | 141 'response_type': 'code token', |
| 142 'state': this.xsrfToken_ | 142 'state': this.xsrfToken_ |
| 143 }); | 143 }); |
| 144 }; | 144 }; |
| 145 | 145 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 168 /** | 168 /** |
| 169 * 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. |
| 170 * @private | 170 * @private |
| 171 */ | 171 */ |
| 172 remoting.ThirdPartyTokenFetcher.prototype.fetchTokenIdentityApi_ = function() { | 172 remoting.ThirdPartyTokenFetcher.prototype.fetchTokenIdentityApi_ = function() { |
| 173 var fullTokenUrl = this.getFullTokenUrl_(); | 173 var fullTokenUrl = this.getFullTokenUrl_(); |
| 174 chrome.identity.launchWebAuthFlow( | 174 chrome.identity.launchWebAuthFlow( |
| 175 {'url': fullTokenUrl, 'interactive': true}, | 175 {'url': fullTokenUrl, 'interactive': true}, |
| 176 this.parseRedirectUrl_.bind(this)); | 176 this.parseRedirectUrl_.bind(this)); |
| 177 }; | 177 }; |
| OLD | NEW |