You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_tools/third_party/gsutil
hinoka@chromium.org c6a2ee6930 Adds SSO auth to gsutil
Code path:
1. plugins.sso_auth is imported, which adds the AuthHandler class to the global state.
2. HasConfiguredCredentials() in gslib/utils.py is called by gsutil, and will return true if "prodaccess" exists on the system, which tells the system that we don't want a no-op auth handler.
3. When a command is called, all the auth handlers are cycled through and sso_auth.SSOAuth is called, which calls a stubby command to emit a gaiamint'ed oauth2 access token, which is then used as the Authorization Header

if --bypass_prodaccess is passed in, then:
1. HasConfiguredCredentials() will bypass the check for prodaccess, as if it didn't exist.
2. plugins.sso_auth does not get imported.
Which will essentially cause gsutil to behave as if this patch never existed.

So the expected behavior is:
=.boto file does not exist, prodaccess exists, but unauthenticated=
Failure: No handler was ready to authenticate. 3 handlers were checked. ['OAuth2Auth', 'HmacAuthV1Handler', 'SSOAuth'] Check your credentials.

=.boto file exists, prodaccess exists, but unauthenticated=
sso_auth will raise NotReadyToAuthenticate, and the .boto file will be used instead

=.boto file exists, prodaccess exists, authenticated=
sso_auth will be run _after_ the default gsutil authenticator, which causes the sso_auth to be used over whatever the default authentication is.

bypass_prodaccess is passed in by default to upload_to_google_storage because we expect people who use upload_to_google_storage to not need prodaccess and have their own boto file already.  Also the sso_auth plugin will only request a readonlyi token, which will not work for uploading.

BUG=258152

Review URL: https://codereview.chromium.org/86123002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@240266 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
..
gslib Adds SSO auth to gsutil 12 years ago
oauth2_plugin Added gsutil/ to depot_tools/third_party/ 13 years ago
plugins Adds SSO auth to gsutil 12 years ago
CHECKSUM Remove code in gsutil that removes http_proxy from the env var 12 years ago
COPYING Added gsutil/ to depot_tools/third_party/ 13 years ago
LICENSE.third_party Added gsutil/ to depot_tools/third_party/ 13 years ago
MANIFEST.in Added gsutil/ to depot_tools/third_party/ 13 years ago
README Added gsutil/ to depot_tools/third_party/ 13 years ago
README.chromium Adds SSO auth to gsutil 12 years ago
README.pkg Added gsutil/ to depot_tools/third_party/ 13 years ago
ReleaseNotes.txt Added gsutil/ to depot_tools/third_party/ 13 years ago
VERSION Added gsutil/ to depot_tools/third_party/ 13 years ago
gsutil Adds SSO auth to gsutil 12 years ago
gsutil.spec.in Added gsutil/ to depot_tools/third_party/ 13 years ago
pkg_util.py Added gsutil/ to depot_tools/third_party/ 13 years ago

README

This directory contains the Python command line tool gsutil, which Google
has released as open source, to demonstrate the Google Storage API and to
provide a tool for manipulating data in the system.

Prerequisites:

Gsutil requires Python 2.6 or later.

To install gsutil take the following steps:

1. Pick a place where you want to install the software.  You can
   install the code wherever you prefer; for brevity the instructions below
   assume you want to install in $HOME/gsutil.

2. To install gsutil on Linux/Unix or MacOS, open a shell window, change
   directories to where you downloaded the gsutil.tar.gz file, and do this:
   % tar xfz gsutil.tar.gz -C $HOME

   Then add the following line to your $HOME/.bashrc shell initialization
   file:
       export PATH=${PATH}:$HOME/gsutil

   The next time you start a shell you should be able to run gsutil from
   the command line.

3. To install gsutil on Windows, install cygwin (http://www.cygwin.com/),
   with at least version 2.6.5 of Python. Once you have that, start a shell
   and follow the Linux instructions above for unpacking and installing gsutil.

4. The first time you try to run gsutil, it will detect that you have no
   configuration file containing your credentials, interactively prompt you,
   and create the file.  

   After this you can use the tool.  Running gsutil with with no arguments
   will print a help summary.

For more information on installing and using gsutil, see
<http://code.google.com/apis/storage/docs/gsutil.html>.