A library for working with the EVE Online SSO.
Project description
# eveauth
[![Travis](https://img.shields.io/travis/Regner/eveauth.svg)](https://travis-ci.org/Regner/eveauth) [![PyPI](https://img.shields.io/pypi/v/eveauth.svg)](https://pypi.python.org/pypi/eveauth/)
A simple library for verifying authorization tokens provided against the EVE
Online SSO. Helper methods and decorators are provided for simplysimplifying the
ability to restrict access based on scopes or a character ID.
## Using
```python
from eveauth import authenticate
# Just get the token information back
token = authenticate(request)
# Require a specific scope
token = authenticate(request, ['character'])
# By default using the authenticate method directly will raise either a
# eveauth.Unauthorized or eveauth.Forbidden exception if something goes wrong or
# missing a scope.
# Decorate a flask view
from eveauth.contrib.flask import authenticate
@authenticate()
@app.route('/v1/<int:character_id>/')
def get_char_stats(character_id):
if request.token['character_id'] != character_id:
abort(403)
# The flask decorator will abort with a 401 or 403 if the eveauth package raises
# one if its exceptions. You only need to handle making sure the character the
# token is for is allowed the resource they are requesting.
```
## Environment Variables
* __EVEAUTH_URL:__ Defaults to 'https://login.eveonline.com/oauth/verify/'. The
URL which will be used to validate the authorization token.
* __EVEAUTH_CACHE_TIME:__ Defaults to 300. How long, in seconds, to cache the
response from the SSO server for.
* __AUTH_TESTING:__
* __TEST_TOKEN_DATA:__
[![Travis](https://img.shields.io/travis/Regner/eveauth.svg)](https://travis-ci.org/Regner/eveauth) [![PyPI](https://img.shields.io/pypi/v/eveauth.svg)](https://pypi.python.org/pypi/eveauth/)
A simple library for verifying authorization tokens provided against the EVE
Online SSO. Helper methods and decorators are provided for simplysimplifying the
ability to restrict access based on scopes or a character ID.
## Using
```python
from eveauth import authenticate
# Just get the token information back
token = authenticate(request)
# Require a specific scope
token = authenticate(request, ['character'])
# By default using the authenticate method directly will raise either a
# eveauth.Unauthorized or eveauth.Forbidden exception if something goes wrong or
# missing a scope.
# Decorate a flask view
from eveauth.contrib.flask import authenticate
@authenticate()
@app.route('/v1/<int:character_id>/')
def get_char_stats(character_id):
if request.token['character_id'] != character_id:
abort(403)
# The flask decorator will abort with a 401 or 403 if the eveauth package raises
# one if its exceptions. You only need to handle making sure the character the
# token is for is allowed the resource they are requesting.
```
## Environment Variables
* __EVEAUTH_URL:__ Defaults to 'https://login.eveonline.com/oauth/verify/'. The
URL which will be used to validate the authorization token.
* __EVEAUTH_CACHE_TIME:__ Defaults to 300. How long, in seconds, to cache the
response from the SSO server for.
* __AUTH_TESTING:__
* __TEST_TOKEN_DATA:__
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eveauth-0.0.3.tar.gz
(3.0 kB
view details)
File details
Details for the file eveauth-0.0.3.tar.gz
.
File metadata
- Download URL: eveauth-0.0.3.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ab1a552e76affffc95ca585a93bd4b4c8bd8cf104e30a384ea5224ff52dd75a |
|
MD5 | bad8b84dd1849261e6eca568817d9cad |
|
BLAKE2b-256 | 27b9a9ac15e61e496415d20ee1ed734e3ba2df6fe6071c575d41d856a75b9b6f |