torrent: use quay.pem to mint JWT (#1425)

This commit is contained in:
Jimmy Zelinskie 2016-05-02 18:10:16 -04:00
parent 9969101dac
commit 437ec84c9f
2 changed files with 9 additions and 6 deletions

View file

@ -298,6 +298,9 @@ class DefaultConfig(object):
# If None, will be calculated off of the SERVER_HOSTNAME (default)
JWTPROXY_AUDIENCE = None
# The location of the private key generated for this instance
INSTANCE_SERVICE_KEY_LOCATION = 'conf/quay.pem'
# Torrent management flags
FEATURE_BITTORRENT = False
BITTORRENT_PIECE_SIZE = 512 * 1024

View file

@ -1,10 +1,9 @@
import time
import hashlib
import urllib
import bencode
import resumablehashlib
import hashlib
import jwt
import resumablehashlib
import time
import urllib
from cachetools import lru_cache
@ -12,6 +11,7 @@ from app import app
ANNOUNCE_URL = app.config.get('BITTORRENT_ANNOUNCE_URL')
PRIVATE_KEY_LOCATION = app.config.get('INSTANCE_SERVICE_KEY_LOCATION')
FILENAME_PEPPER = app.config.get('BITTORRENT_FILENAME_PEPPER')
REGISTRY_TITLE = app.config.get('REGISTRY_TITLE')
JWT_ISSUER = app.config.get('JWT_AUTH_TOKEN_ISSUER')
@ -29,7 +29,7 @@ def _torrent_jwt(info_dict):
'infohash': _infohash(info_dict),
}
private_key = _load_private_key(app.config['JWT_AUTH_PRIVATE_KEY_PATH'])
private_key = _load_private_key(PRIVATE_KEY_LOCATION)
return jwt.encode(token_data, private_key, 'RS256')
def _infohash(infodict):