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

Side by Side Diff: chrome/browser/chromeos/policy/wildcard_login_checker.h

Issue 148843002: Make an online wildcard login check for enterprise devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Joao's comments. Created 6 years, 10 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
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_
7
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/policy/core/common/cloud/user_info_fetcher.h"
12 #include "google_apis/gaia/google_service_auth_error.h"
13
14 namespace net {
15 class URLRequestContextGetter;
16 }
17
18 namespace policy {
19
20 class PolicyOAuth2TokenFetcher;
21
22 // Performs online verification whether wildcard login is allowed, i.e. whether
23 // the user is a hosted user. This class performs an asynchronous check and
24 // reports the result via a callback.
25 class WildcardLoginChecker : public UserInfoFetcher::Delegate {
26 public:
27 typedef base::Callback<void(bool)> StatusCallback;
28
29 WildcardLoginChecker();
30 virtual ~WildcardLoginChecker();
31
32 // Starts checking. The result will be reported via |callback_|.
33 void Start(scoped_refptr<net::URLRequestContextGetter> signin_context,
34 const StatusCallback& callback);
35
36 // Starts checking with a provided access token.
37 void StartWithAccessToken(const std::string& access_token,
38 const StatusCallback& callback);
39
40 // UserInfoFetcher::Delegate:
41 virtual void OnGetUserInfoSuccess(const base::DictionaryValue* response)
42 OVERRIDE;
43 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error)
44 OVERRIDE;
45
46 private:
47 // Starts the check after successful token minting.
48 void OnPolicyTokenFetched(const std::string& access_token,
49 const GoogleServiceAuthError& error);
50
51 // Starts the user info fetcher.
52 void StartUserInfoFetcher(const std::string& access_token);
53
54 // Handles the response of the check and calls ReportResult().
55 void OnCheckCompleted(bool result);
56
57 StatusCallback callback_;
58
59 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_;
60 scoped_ptr<UserInfoFetcher> user_info_fetcher_;
61
62 DISALLOW_COPY_AND_ASSIGN(WildcardLoginChecker);
63 };
64
65 } // namespace policy
66
67 #endif // CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698