OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ | 5 #ifndef CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ |
6 #define CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ | 6 #define CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
16 #include "chromeos/cryptohome/cryptohome_parameters.h" | 16 #include "chromeos/cryptohome/cryptohome_parameters.h" |
17 | 17 |
| 18 class AccountId; |
| 19 |
18 namespace chromeos { | 20 namespace chromeos { |
19 | 21 |
20 class AuthStatusConsumer; | 22 class AuthStatusConsumer; |
21 class UserContext; | 23 class UserContext; |
22 | 24 |
23 // An interface to interact with cryptohomed: mount home dirs, create new home | 25 // An interface to interact with cryptohomed: mount home dirs, create new home |
24 // dirs, update passwords. | 26 // dirs, update passwords. |
25 // | 27 // |
26 // Typical flow: | 28 // Typical flow: |
27 // AuthenticateToMount() calls cryptohomed to perform offline login, | 29 // AuthenticateToMount() calls cryptohomed to perform offline login, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // an error otherwise. On success, the user ID hash (used as the mount point) | 63 // an error otherwise. On success, the user ID hash (used as the mount point) |
62 // will be passed to |success_callback|. | 64 // will be passed to |success_callback|. |
63 virtual void AuthenticateToMount(const UserContext& context, | 65 virtual void AuthenticateToMount(const UserContext& context, |
64 const ResultCallback& success_callback) = 0; | 66 const ResultCallback& success_callback) = 0; |
65 | 67 |
66 // This call will attempt to authenticate the user with the key (and key | 68 // This call will attempt to authenticate the user with the key (and key |
67 // label) in |context|. No further actions are taken after authentication. | 69 // label) in |context|. No further actions are taken after authentication. |
68 virtual void AuthenticateToCheck(const UserContext& context, | 70 virtual void AuthenticateToCheck(const UserContext& context, |
69 const base::Closure& success_callback) = 0; | 71 const base::Closure& success_callback) = 0; |
70 | 72 |
71 // This call will create and mount the home dir for |user_id| with the given | 73 // This call will create and mount the home dir for |account_id| with the |
72 // |keys| if the home dir is missing. If the home dir exists already, a mount | 74 // given |keys| if the home dir is missing. If the home dir exists already, a |
73 // attempt will be performed using the first key in |keys| for authentication. | 75 // mount attempt will be performed using the first key in |keys| for |
74 // Note that all |keys| should have been transformed from plain text already. | 76 // authentication. Note that all |keys| should have been transformed from |
| 77 // plain text already. |
75 // This method does not alter them. | 78 // This method does not alter them. |
76 virtual void CreateMount(const std::string& user_id, | 79 virtual void CreateMount(const AccountId& account_id, |
77 const std::vector<cryptohome::KeyDefinition>& keys, | 80 const std::vector<cryptohome::KeyDefinition>& keys, |
78 const ResultCallback& success_callback) = 0; | 81 const ResultCallback& success_callback) = 0; |
79 | 82 |
80 // Attempts to add a new |key| for the user identified/authorized by | 83 // Attempts to add a new |key| for the user identified/authorized by |
81 // |context|. If a key with the same label already exists, the behavior | 84 // |context|. If a key with the same label already exists, the behavior |
82 // depends on the |replace_existing| flag. If the flag is set, the old key is | 85 // depends on the |replace_existing| flag. If the flag is set, the old key is |
83 // replaced. If the flag is not set, an error occurs. It is not allowed to | 86 // replaced. If the flag is not set, an error occurs. It is not allowed to |
84 // replace the key used for authorization. | 87 // replace the key used for authorization. |
85 virtual void AddKey(const UserContext& context, | 88 virtual void AddKey(const UserContext& context, |
86 const cryptohome::KeyDefinition& key, | 89 const cryptohome::KeyDefinition& key, |
(...skipping 29 matching lines...) Expand all Loading... |
116 | 119 |
117 private: | 120 private: |
118 friend class base::RefCountedThreadSafe<ExtendedAuthenticator>; | 121 friend class base::RefCountedThreadSafe<ExtendedAuthenticator>; |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(ExtendedAuthenticator); | 123 DISALLOW_COPY_AND_ASSIGN(ExtendedAuthenticator); |
121 }; | 124 }; |
122 | 125 |
123 } // namespace chromeos | 126 } // namespace chromeos |
124 | 127 |
125 #endif // CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ | 128 #endif // CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ |
OLD | NEW |