keyserver: insert rotation policy into metadata
This commit is contained in:
parent
885a41e6f5
commit
e456228434
1 changed files with 7 additions and 2 deletions
|
@ -97,13 +97,19 @@ def get_service_key(service, kid):
|
|||
|
||||
@key_server.route('/services/<service>/keys/<kid>', methods=['PUT'])
|
||||
def put_service_keys(service, kid):
|
||||
metadata = {'ip': request.remote_addr}
|
||||
|
||||
expiration_date = request.args.get('expiration', None)
|
||||
if expiration_date:
|
||||
if expiration_date is not None:
|
||||
try:
|
||||
expiration_date = datetime.utcfromtimestamp(float(expiration_date))
|
||||
except ValueError:
|
||||
abort(400)
|
||||
|
||||
rotation_ttl = request.args.get('rotation', None)
|
||||
if rotation_ttl is not None:
|
||||
metadata['rotation_ttl'] = rotation_ttl
|
||||
|
||||
try:
|
||||
jwk = request.get_json()
|
||||
except ValueError:
|
||||
|
@ -119,7 +125,6 @@ def put_service_keys(service, kid):
|
|||
|
||||
_validate_jwk(jwk, kid)
|
||||
|
||||
metadata = {'ip': request.remote_addr}
|
||||
signer_kid = _signer_kid(encoded_jwt)
|
||||
|
||||
if kid == signer_kid or signer_kid is None:
|
||||
|
|
Reference in a new issue