diff options
Diffstat (limited to 'remoting/host/user_authenticator_mac.cc')
-rw-r--r-- | remoting/host/user_authenticator_mac.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/remoting/host/user_authenticator_mac.cc b/remoting/host/user_authenticator_mac.cc index dd44b06..88c0951 100644 --- a/remoting/host/user_authenticator_mac.cc +++ b/remoting/host/user_authenticator_mac.cc @@ -2,23 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/user_authenticator_mac.h" +#include "remoting/host/user_authenticator.h" #include <Security/Security.h> #include <string> +#include "base/basictypes.h" #include "base/logging.h" namespace remoting { -static const char kAuthorizationRightName[] = "system.login.tty"; +namespace { -UserAuthenticatorMac::UserAuthenticatorMac() { -} +class UserAuthenticatorMac : public UserAuthenticator { + public: + UserAuthenticatorMac() {} + virtual ~UserAuthenticatorMac() {} + virtual bool Authenticate(const std::string& username, + const std::string& password); -UserAuthenticatorMac::~UserAuthenticatorMac() { -} + private: + DISALLOW_COPY_AND_ASSIGN(UserAuthenticatorMac); +}; + +const char kAuthorizationRightName[] = "system.login.tty"; bool UserAuthenticatorMac::Authenticate(const std::string& username, const std::string& password) { @@ -33,6 +41,7 @@ bool UserAuthenticatorMac::Authenticate(const std::string& username, AuthorizationRights rights; rights.count = 1; rights.items = &right; + // Passing the username/password as an "environment" parameter causes these // to be submitted to the Security Framework, instead of the interactive // password prompt appearing on the host system. Valid on OS X 10.4 and @@ -66,6 +75,8 @@ bool UserAuthenticatorMac::Authenticate(const std::string& username, } } +} // namespace + // static UserAuthenticator* UserAuthenticator::Create() { return new UserAuthenticatorMac(); |