| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 module authentication; | 5 module authentication; |
| 6 | 6 |
| 7 // Specifies if the type of stored credential is a plain text password, | 7 // Specifies if the type of stored credential is a plain text password, |
| 8 // password in encrypted form, fully scoped master OAuth token or | 8 // password in encrypted form, fully scoped master OAuth token or |
| 9 // downscoped OAuth token. | 9 // downscoped OAuth token. |
| 10 enum CredentialType { | 10 enum CredentialType { |
| 11 DOWNSCOPED_OAUTH_REFRESH_TOKEN = 1 | 11 DOWNSCOPED_OAUTH_REFRESH_TOKEN = 1, |
| 12 }; | 12 }; |
| 13 | 13 |
| 14 // Specifies the type of identity provider for authenticating user. | 14 // Specifies the type of identity provider for authenticating user. |
| 15 enum AuthProvider { | 15 enum AuthProvider { |
| 16 GOOGLE = 1 | 16 GOOGLE = 1, |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 // This struct is used to persist long lived credentials for each user and is | 19 // This struct is used to persist long lived credentials for each user and is |
| 20 // not passed between services. | 20 // not passed between services. |
| 21 struct Credentials { | 21 struct Credentials { |
| 22 // The type of authentication service provider such as Google, Facebook, | 22 // The type of authentication service provider such as Google, Facebook, |
| 23 // Twitter, or Amazon. | 23 // Twitter, or Amazon. |
| 24 AuthProvider auth_provider; | 24 AuthProvider auth_provider; |
| 25 // Password or equivalent token grant that acts as the key to user data such | 25 // Password or equivalent token grant that acts as the key to user data such |
| 26 // as encrypted password or fully scoped master OAuth token. | 26 // as encrypted password or fully scoped master OAuth token. |
| 27 string token; | 27 string token; |
| 28 // Type of stored credential. | 28 // Type of stored credential. |
| 29 CredentialType credential_type; | 29 CredentialType credential_type; |
| 30 // List of permissible scopes for this saved grant. | 30 // List of permissible scopes for this saved grant. |
| 31 string scopes; | 31 string scopes; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Database for the credentials database implementation. | 34 // Database for the credentials database implementation. |
| 35 struct CredentialStore { | 35 struct CredentialStore { |
| 36 // Version of the database. | 36 // Version of the database. |
| 37 uint32 version; | 37 uint32 version; |
| 38 // Map from user account to credentials. User account is identified by a | 38 // Map from user account to credentials. User account is identified by a |
| 39 // user's unique account name such as email id. | 39 // user's unique account name such as email id. |
| 40 map<string, Credentials> credentials; | 40 map<string, Credentials> credentials; |
| 41 }; | 41 }; |
| OLD | NEW |