OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 [DartPackage="mojo_services", JavaPackage="org.chromium.mojo.authentication"] | 5 [DartPackage="mojo_services", |
| 6 JavaPackage="org.chromium.mojo.authentication"] |
6 module authentication; | 7 module authentication; |
7 | 8 |
8 // Interface to handle user identity and authentication tokens. | 9 // Interface to handle user identity and authentication tokens. |
9 // TODO(qsr): This API only handles google accounts at this time. It will need | 10 // TODO(qsr): This API only handles google accounts at this time. It will need |
10 // to be extended to allow generic account manager on the platform. | 11 // to be extended to allow generic account manager on the platform. |
11 [ServiceName="authentication::AuthenticationService"] | 12 [ServiceName="authentication::AuthenticationService"] |
12 interface AuthenticationService { | 13 interface AuthenticationService { |
13 // Requests a Google account to use. In case of success, error will be null. | 14 // Requests a Google account to use. In case of success, error will be null. |
14 // In case of error, username will be null and error will contain a | 15 // In case of error, username will be null and error will contain a |
15 // description of the error. If |return_last_selected| is true and the client | 16 // description of the error. If |return_last_selected| is true and the client |
16 // application already selected an account, the same account will be returned | 17 // application already selected an account, the same account will be returned |
17 // without user intervention. | 18 // without user intervention. |
18 SelectAccount(bool return_last_selected) => (string? username, string? error); | 19 SelectAccount(bool return_last_selected) => (string? username, string? error); |
19 | 20 |
20 // Requests an oauth2 token for the given Google account with the given | 21 // Requests an oauth2 token for the given Google account with the given |
21 // scopes. In case of error, token will be null and error will contain a | 22 // scopes. In case of error, token will be null and error will contain a |
22 // description of the error. | 23 // description of the error. |
23 GetOAuth2Token(string username, array<string> scopes) => | 24 GetOAuth2Token(string username, array<string> scopes) |
24 (string? token, string? error); | 25 => (string? token, string? error); |
25 | 26 |
26 // Requests to clear a previously acquired token. This should be called when a | 27 // Requests to clear a previously acquired token. This should be called when a |
27 // token is refused by a server component before requesting a new token to | 28 // token is refused by a server component before requesting a new token to |
28 // clear the token from any cache. | 29 // clear the token from any cache. |
29 ClearOAuth2Token(string token); | 30 ClearOAuth2Token(string token); |
30 | 31 |
31 // Requests an oauth2 device code response for the given set of scopes. In | 32 // Requests an oauth2 device code response for the given set of scopes. In |
32 // case of error, all response parameters other than error, namely | 33 // case of error, all response parameters other than error, namely |
33 // verifcation_url, device_code and user_code will be null and error will | 34 // verifcation_url, device_code and user_code will be null and error will |
34 // contain a description of the error. To provision FNL like systems with | 35 // contain a description of the error. To provision FNL like systems with |
35 // Google account credentials, invoke GetOAuth2DeviceCode() method followed by | 36 // Google account credentials, invoke GetOAuth2DeviceCode() method followed by |
36 // AddAccount() instead of using SelectAccount(), which only works for | 37 // AddAccount() instead of using SelectAccount(), which only works for |
37 // Android. | 38 // Android. |
38 GetOAuth2DeviceCode(array<string> scopes) => (string? verification_url, | 39 GetOAuth2DeviceCode(array<string> scopes) |
39 string? device_code, | 40 => (string? verification_url, |
40 string? user_code, | 41 string? device_code, |
41 string? error); | 42 string? user_code, |
| 43 string? error); |
42 | 44 |
43 // Exchanges an oauth2 device code to a refresh token for the granted user, | 45 // Exchanges an oauth2 device code to a refresh token for the granted user, |
44 // and stores it locally in a secure storage location on FNL. For future | 46 // and stores it locally in a secure storage location on FNL. For future |
45 // GetOAuth2Token requests, a new access token is minted from this refresh | 47 // GetOAuth2Token requests, a new access token is minted from this refresh |
46 // token and returned to the calling mojo app. | 48 // token and returned to the calling mojo app. |
47 AddAccount(string device_code) => (string? username, string? error); | 49 AddAccount(string device_code) => (string? username, string? error); |
48 }; | 50 }; |
OLD | NEW |