service keys: add rotation_duration field
This commit is contained in:
parent
6577ac3e62
commit
370ac3ecd0
5 changed files with 21 additions and 46 deletions
|
@ -95,6 +95,7 @@ def get_service_key(service, kid):
|
|||
def put_service_key(service, kid):
|
||||
metadata = {'ip': request.remote_addr}
|
||||
|
||||
rotation_duration = request.args.get('rotation', None)
|
||||
expiration_date = request.args.get('expiration', None)
|
||||
if expiration_date is not None:
|
||||
try:
|
||||
|
@ -103,10 +104,6 @@ def put_service_key(service, kid):
|
|||
logger.exception('Error parsing expiration date on key')
|
||||
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:
|
||||
|
@ -128,7 +125,8 @@ def put_service_key(service, kid):
|
|||
if kid == signer_kid or signer_kid is None:
|
||||
# The key is self-signed. Create a new instance and await approval.
|
||||
_validate_jwt(encoded_jwt, jwk, service)
|
||||
data.model.service_keys.create_service_key('', kid, service, jwk, metadata, expiration_date)
|
||||
data.model.service_keys.create_service_key('', kid, service, jwk, metadata, expiration_date,
|
||||
rotation_duration=rotation_duration)
|
||||
|
||||
key_log_metadata = {
|
||||
'kid': kid,
|
||||
|
|
Reference in a new issue