Binstar/binstar_client — pull request #22 by srossross (2013-07-29 21:17:44+00:00)
Title: New Authentication

I am partially finished implementing a new authentication protocol for 1.0

### Features:
[x] Prompt user to login if they are doing operation that requires authentication
[ ] Add better error and console logging
[x] Added IP, hostname, and other metadata to authentication tokens
[x] Added resource restiction to authentication tokens
[x] Added auth sub command
[ ] Update api,conda and pypi sites to handle new tokens
[x] Added -t/--token command line argument for non-permanent logins

### Auth Sub Command help:

```
$ binstar auth -h
usage: binstar auth [-h] [-n NAME] [--url URL] [--max-age MAX_AGE]
[--resource RESOURCE] (-l | -r ID [ID ...] | -c)

Manage Authentication tokens

optional arguments:
-h, --help show this help message and exit
-n NAME, --name NAME The name of the application that will use this token
--url URL The url of the application that will use this token
--max-age MAX_AGE The maximum age in seconds that this token will be
valid for
--resource RESOURCE The resource path that this token is valid
-l, --list list all user authentication tokens
-r ID [ID ...], --remove ID [ID ...]
remove authentication tokens
-c, --create Create an authentication token
```

### Example use cases:

1. Authenticate temporary token to upload a single package (*username/package_name*) without logging in available for 10 minutes:

```bash
$ TOKEN=$(binstar auth -c --resource 'api:/*/username/package_name/**' --max-age=600)
Username: sean
Password: ****

binstar -t $TOKEN upload package_name.tar.bz2
```