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

Side by Side Diff: remoting/host/user_authenticator_mac.cc

Issue 6780014: Clean up remoting project (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got rid of ref counting on user authenticator Created 9 years, 8 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
« no previous file with comments | « remoting/host/user_authenticator_mac.h ('k') | remoting/host/user_authenticator_pam.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "remoting/host/user_authenticator_mac.h" 5 #include "remoting/host/user_authenticator.h"
6 6
7 #include <Security/Security.h> 7 #include <Security/Security.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 13
13 namespace remoting { 14 namespace remoting {
14 15
15 static const char kAuthorizationRightName[] = "system.login.tty"; 16 namespace {
16 17
17 UserAuthenticatorMac::UserAuthenticatorMac() { 18 class UserAuthenticatorMac : public UserAuthenticator {
18 } 19 public:
20 UserAuthenticatorMac() {}
21 virtual ~UserAuthenticatorMac() {}
22 virtual bool Authenticate(const std::string& username,
23 const std::string& password);
19 24
20 UserAuthenticatorMac::~UserAuthenticatorMac() { 25 private:
21 } 26 DISALLOW_COPY_AND_ASSIGN(UserAuthenticatorMac);
27 };
28
29 const char kAuthorizationRightName[] = "system.login.tty";
22 30
23 bool UserAuthenticatorMac::Authenticate(const std::string& username, 31 bool UserAuthenticatorMac::Authenticate(const std::string& username,
24 const std::string& password) { 32 const std::string& password) {
25 // The authorization right being requested. This particular right allows 33 // The authorization right being requested. This particular right allows
26 // testing of a username/password, as if the user were logging on to the 34 // testing of a username/password, as if the user were logging on to the
27 // system locally. 35 // system locally.
28 AuthorizationItem right; 36 AuthorizationItem right;
29 right.name = kAuthorizationRightName; 37 right.name = kAuthorizationRightName;
30 right.valueLength = 0; 38 right.valueLength = 0;
31 right.value = NULL; 39 right.value = NULL;
32 right.flags = 0; 40 right.flags = 0;
33 AuthorizationRights rights; 41 AuthorizationRights rights;
34 rights.count = 1; 42 rights.count = 1;
35 rights.items = &right; 43 rights.items = &right;
44
36 // Passing the username/password as an "environment" parameter causes these 45 // Passing the username/password as an "environment" parameter causes these
37 // to be submitted to the Security Framework, instead of the interactive 46 // to be submitted to the Security Framework, instead of the interactive
38 // password prompt appearing on the host system. Valid on OS X 10.4 and 47 // password prompt appearing on the host system. Valid on OS X 10.4 and
39 // later versions. 48 // later versions.
40 AuthorizationItem environment_items[2]; 49 AuthorizationItem environment_items[2];
41 environment_items[0].name = kAuthorizationEnvironmentUsername; 50 environment_items[0].name = kAuthorizationEnvironmentUsername;
42 environment_items[0].valueLength = username.size(); 51 environment_items[0].valueLength = username.size();
43 environment_items[0].value = const_cast<char*>(username.data()); 52 environment_items[0].value = const_cast<char*>(username.data());
44 environment_items[0].flags = 0; 53 environment_items[0].flags = 0;
45 environment_items[1].name = kAuthorizationEnvironmentPassword; 54 environment_items[1].name = kAuthorizationEnvironmentPassword;
(...skipping 13 matching lines...) Expand all
59 68
60 case errAuthorizationDenied: 69 case errAuthorizationDenied:
61 return false; 70 return false;
62 71
63 default: 72 default:
64 LOG(ERROR) << "AuthorizationCreate returned " << status; 73 LOG(ERROR) << "AuthorizationCreate returned " << status;
65 return false; 74 return false;
66 } 75 }
67 } 76 }
68 77
78 } // namespace
79
69 // static 80 // static
70 UserAuthenticator* UserAuthenticator::Create() { 81 UserAuthenticator* UserAuthenticator::Create() {
71 return new UserAuthenticatorMac(); 82 return new UserAuthenticatorMac();
72 } 83 }
73 84
74 } // namespace remoting 85 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/user_authenticator_mac.h ('k') | remoting/host/user_authenticator_pam.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698