converging on proper rotation

This commit is contained in:
Jimmy Zelinskie 2016-03-28 19:00:00 -04:00 committed by Jimmy Zelinskie
parent aaf9e83278
commit f406942984
4 changed files with 101 additions and 67 deletions

View file

@ -514,7 +514,7 @@ class SuperUserServiceKeyManagement(ApiResource):
@require_scope(scopes.SUPERUSER)
def get(self):
if SuperUserPermission().can():
return jsonify(list(model.service_keys.get_service_keys(False)))
return jsonify(model.service_keys.get_keys())
abort(403)
@verify_not_prod
@ -538,7 +538,7 @@ class SuperUserServiceKeyManagement(ApiResource):
metadata.update({
'created_by': 'Quay SuperUser Panel',
'creator': user.username,
'superuser ip': request.remote_addr,
'ip': request.remote_addr,
})
private_key = RSA.generate(2048)
@ -551,7 +551,8 @@ class SuperUserServiceKeyManagement(ApiResource):
metadata, expiration_date)
model.service_keys.approve_service_key(kid, user, ServiceKeyApprovalType.SUPERUSER)
return jsonify({'private_key': private_key.exportKey('PEM')})
return jsonify({'public_key': private_key.publickey().exportKey('PEM'),
'private_key': private_key.exportKey('PEM')})
abort(403)
@ -559,7 +560,7 @@ class SuperUserServiceKeyManagement(ApiResource):
@resource('/v1/superuser/keys/<kid>')
@path_param('kid', 'The unique identifier for a service key')
@show_if(features.SUPER_USERS)
class SuperUserServiceKeyManagement(ApiResource):
class SuperUserServiceKeyUpdater(ApiResource):
""" Resource for managing service keys. """
schemas = {
'PutServiceKey': {