Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: chrome/browser/policy/cloud_policy_identity_strategy.h

Issue 6537020: Update policy backend and testserver for the newest policy protocol (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more last minute changes Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
12 13
13 namespace policy { 14 namespace policy {
14 15
16 namespace em = enterprise_management;
17
15 // Manages a device management token, i.e. an identifier that represents a 18 // Manages a device management token, i.e. an identifier that represents a
16 // registration with the device management service, and the associated 19 // registration with the device management service, and the associated
17 // credentials. Responsibilities include storing and loading the token from 20 // credentials. Responsibilities include storing and loading the token from
18 // disk, observing and triggering relevant notifications. 21 // disk, observing and triggering relevant notifications.
19 class CloudPolicyIdentityStrategy { 22 class CloudPolicyIdentityStrategy {
20 public: 23 public:
21 class Observer { 24 class Observer {
22 public: 25 public:
23 virtual ~Observer() {} 26 virtual ~Observer() {}
24 27
25 // Notifies observers that the effective token for fetching policy has 28 // Notifies observers that the effective token for fetching policy has
26 // changed. The token can be queried by calling GetDeviceToken(). 29 // changed. The token can be queried by calling GetDeviceToken().
27 virtual void OnDeviceTokenChanged() = 0; 30 virtual void OnDeviceTokenChanged() = 0;
28 31
29 // Authentication credentials for talking to the device management service 32 // Authentication credentials for talking to the device management service
30 // changed. New auth data is available through GetCredentials(). 33 // changed. New auth data is available through GetCredentials().
31 virtual void OnCredentialsChanged() = 0; 34 virtual void OnCredentialsChanged() = 0;
32 }; 35 };
33 36
34 CloudPolicyIdentityStrategy(); 37 CloudPolicyIdentityStrategy();
35 virtual ~CloudPolicyIdentityStrategy(); 38 virtual ~CloudPolicyIdentityStrategy();
36 39
37 void AddObserver(Observer* obs); 40 void AddObserver(Observer* obs);
38 void RemoveObserver(Observer* obs); 41 void RemoveObserver(Observer* obs);
39 42
40 // Returns the device management token, if available. Returns the empty string 43 // Returns the device management token, if available. Returns the empty string
41 // if the device token is currently unavailable. 44 // if the device token is currently unavailable.
42 virtual std::string GetDeviceToken() = 0; 45 virtual std::string GetDeviceToken() = 0;
43 46
44 // Returns the device ID for this device. 47 // Returns the device ID for this device. This is a unique identifier that is
48 // randomly generated at registration time on the client side. It always has
49 // to be sent along with the device token to the server.
45 virtual std::string GetDeviceID() = 0; 50 virtual std::string GetDeviceID() = 0;
46 51
52 // Returns physical machine ID for this device.
53 virtual std::string GetMachineID() = 0;
54
55 // Returns the policy type to be used for registering at the device management
56 // server.
57 virtual em::DeviceRegisterRequest_Type GetPolicyRegisterType() = 0;
58
59 // Returns the policy type to be used for requesting policies from the device
60 // management server.
61 virtual std::string GetPolicyType() = 0;
62
47 // Retrieves authentication credentials to use when talking to the device 63 // Retrieves authentication credentials to use when talking to the device
48 // management service. Returns true if the data is available and writes the 64 // management service. Returns true if the data is available and writes the
49 // values to the provided pointers. 65 // values to the provided pointers.
50 virtual bool GetCredentials(std::string* username, 66 virtual bool GetCredentials(std::string* username,
51 std::string* auth_token) = 0; 67 std::string* auth_token) = 0;
52 68
53 // Notifies the identity strategy that a new token has been fetched. It is up 69 // Notifies the identity strategy that a new token has been fetched. It is up
54 // to the identity strategy to store the token, decide whether it is going 70 // to the identity strategy to store the token, decide whether it is going
55 // to be used, send out an appropriate OnDeviceTokenChanged() notification 71 // to be used, send out an appropriate OnDeviceTokenChanged() notification
56 // and return the new token in GetDeviceToken() calls. 72 // and return the new token in GetDeviceToken() calls.
57 virtual void OnDeviceTokenAvailable(const std::string& token) = 0; 73 virtual void OnDeviceTokenAvailable(const std::string& token) = 0;
58 74
59 protected: 75 protected:
60 // Notify observers that the effective token has changed. 76 // Notify observers that the effective token has changed.
61 void NotifyDeviceTokenChanged(); 77 void NotifyDeviceTokenChanged();
62 78
63 // Notify observers about authentication data change. 79 // Notify observers about authentication data change.
64 void NotifyAuthChanged(); 80 void NotifyAuthChanged();
65 81
66 private: 82 private:
67 ObserverList<Observer, true> observer_list_; 83 ObserverList<Observer, true> observer_list_;
68 84
69 DISALLOW_COPY_AND_ASSIGN(CloudPolicyIdentityStrategy); 85 DISALLOW_COPY_AND_ASSIGN(CloudPolicyIdentityStrategy);
70 }; 86 };
71 87
72 } // namespace policy 88 } // namespace policy
73 89
74 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ 90 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_controller_unittest.cc ('k') | chrome/browser/policy/device_management_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698