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/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.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 namespace user_manager { |
| 19 class UserID; |
| 20 } |
| 21 |
18 namespace chromeos { | 22 namespace chromeos { |
19 | 23 |
20 class AuthStatusConsumer; | 24 class AuthStatusConsumer; |
21 class UserContext; | 25 class UserContext; |
22 | 26 |
23 // An interface to interact with cryptohomed: mount home dirs, create new home | 27 // An interface to interact with cryptohomed: mount home dirs, create new home |
24 // dirs, update passwords. | 28 // dirs, update passwords. |
25 // | 29 // |
26 // Typical flow: | 30 // Typical flow: |
27 // AuthenticateToMount() calls cryptohomed to perform offline login, | 31 // AuthenticateToMount() calls cryptohomed to perform offline login, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // This call will attempt to authenticate the user with the key (and key | 70 // This call will attempt to authenticate the user with the key (and key |
67 // label) in |context|. No further actions are taken after authentication. | 71 // label) in |context|. No further actions are taken after authentication. |
68 virtual void AuthenticateToCheck(const UserContext& context, | 72 virtual void AuthenticateToCheck(const UserContext& context, |
69 const base::Closure& success_callback) = 0; | 73 const base::Closure& success_callback) = 0; |
70 | 74 |
71 // This call will create and mount the home dir for |user_id| with the given | 75 // This call will create and mount the home dir for |user_id| with the given |
72 // |keys| if the home dir is missing. If the home dir exists already, a mount | 76 // |keys| if the home dir is missing. If the home dir exists already, a mount |
73 // attempt will be performed using the first key in |keys| for authentication. | 77 // attempt will be performed using the first key in |keys| for authentication. |
74 // Note that all |keys| should have been transformed from plain text already. | 78 // Note that all |keys| should have been transformed from plain text already. |
75 // This method does not alter them. | 79 // This method does not alter them. |
76 virtual void CreateMount(const std::string& user_id, | 80 virtual void CreateMount(const user_manager::UserID& user_id, |
77 const std::vector<cryptohome::KeyDefinition>& keys, | 81 const std::vector<cryptohome::KeyDefinition>& keys, |
78 const ResultCallback& success_callback) = 0; | 82 const ResultCallback& success_callback) = 0; |
79 | 83 |
80 // Attempts to add a new |key| for the user identified/authorized by | 84 // 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 | 85 // |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 | 86 // 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 | 87 // replaced. If the flag is not set, an error occurs. It is not allowed to |
84 // replace the key used for authorization. | 88 // replace the key used for authorization. |
85 virtual void AddKey(const UserContext& context, | 89 virtual void AddKey(const UserContext& context, |
86 const cryptohome::KeyDefinition& key, | 90 const cryptohome::KeyDefinition& key, |
(...skipping 29 matching lines...) Expand all Loading... |
116 | 120 |
117 private: | 121 private: |
118 friend class base::RefCountedThreadSafe<ExtendedAuthenticator>; | 122 friend class base::RefCountedThreadSafe<ExtendedAuthenticator>; |
119 | 123 |
120 DISALLOW_COPY_AND_ASSIGN(ExtendedAuthenticator); | 124 DISALLOW_COPY_AND_ASSIGN(ExtendedAuthenticator); |
121 }; | 125 }; |
122 | 126 |
123 } // namespace chromeos | 127 } // namespace chromeos |
124 | 128 |
125 #endif // CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ | 129 #endif // CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_H_ |
OLD | NEW |