summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 18:55:35 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 18:55:35 +0000
commit5405bacef906d6539d2e267fdd1ce796a88d8b6c (patch)
treee235b586c21bf68a34e17622f5bb905a255dbe89 /remoting/tools
parent437eff7e79871ebaa8a791d2fd9574615318c5ed (diff)
downloadchromium_src-5405bacef906d6539d2e267fdd1ce796a88d8b6c.zip
chromium_src-5405bacef906d6539d2e267fdd1ce796a88d8b6c.tar.gz
chromium_src-5405bacef906d6539d2e267fdd1ce796a88d8b6c.tar.bz2
Remove the need to have separate config for authentication.
Previously host was opening two separate configs, but that doesn't seem to be very useful. With that change the host still supports --auth-config option, but it no longer requires auth config and doesn't try to open auth.json by default. Review URL: https://chromiumcodereview.appspot.com/10825121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149453 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-xremoting/tools/me2me_virtual_host.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py
index 21eebb6..95ee7b7 100755
--- a/remoting/tools/me2me_virtual_host.py
+++ b/remoting/tools/me2me_virtual_host.py
@@ -44,9 +44,6 @@ XSESSION_COMMAND = None
REMOTING_COMMAND = "remoting_me2me_host"
-# Command-line switch for passing the config path to remoting_me2me_host.
-HOST_CONFIG_SWITCH_NAME = "host-config"
-
# Needs to be an absolute path, since the current working directory is changed
# when this process self-daemonizes.
SCRIPT_PATH = os.path.dirname(sys.argv[0])
@@ -148,21 +145,24 @@ class Host:
server = 'www.googleapis.com'
url = 'https://' + server + '/chromoting/v1/@me/hosts'
- def __init__(self, config_file):
+ def __init__(self, config_file, auth):
+ """
+ Args:
+ config_file: Host configuration file path
+ auth: Authentication object with credentials for authenticating with the
+ Directory service.
+ """
self.config_file = config_file
+ self.auth = auth
self.host_id = str(uuid.uuid1())
self.host_name = socket.gethostname()
self.host_secret_hash = None
self.private_key = None
- def register(self, auth):
+ def register(self):
"""Generates a private key for the stored |host_id|, and registers it with
the Directory service.
- Args:
- auth: Authentication object with credentials for authenticating with the
- Directory service.
-
Raises:
urllib2.HTTPError: An error occurred talking to the Directory server
(for example, if the |auth| credentials were rejected).
@@ -184,7 +184,7 @@ class Host:
}
params = json.dumps(json_data)
headers = {
- "Authorization": "GoogleLogin auth=" + auth.chromoting_auth_token,
+ "Authorization": "GoogleLogin auth=" + self.auth.chromoting_auth_token,
"Content-Type": "application/json",
}
@@ -383,7 +383,8 @@ class Desktop:
def launch_host(self, host):
# Start remoting host
args = [locate_executable(REMOTING_COMMAND),
- "--%s=%s" % (HOST_CONFIG_SWITCH_NAME, host.config_file)]
+ "--host_config=%s" % (host.config_file),
+ "--auth_config=%s" % (host.auth.config_file)]
self.host_proc = subprocess.Popen(args, env=self.child_env)
if not self.host_proc.pid:
raise Exception("Could not start remoting host")
@@ -692,10 +693,11 @@ def main():
settings_file.write(options.explicit_config)
settings_file.close()
+ # TODO(sergeyu): Move auth parameters to the host config.
auth = Authentication(os.path.join(CONFIG_DIR, "auth.json"))
need_auth_tokens = not auth.load_config()
- host = Host(os.path.join(CONFIG_DIR, "host#%s.json" % host_hash))
+ host = Host(os.path.join(CONFIG_DIR, "host#%s.json" % host_hash), auth)
register_host = not host.load_config()
# Outside the loop so user doesn't get asked twice.
@@ -726,7 +728,7 @@ def main():
try:
if register_host:
- host.register(auth)
+ host.register()
host.save_config()
except urllib2.HTTPError, err:
if err.getcode() == 401: