mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Allow services to have multiple api keys.
/service/<service_id>/api-key/renew has been renamed to /service/<service_id>/api-key /service/<service_id>/api-key now creates a token and no longer expires the existing api key. Moved test for this endpoint to it's own file.
This commit is contained in:
@@ -57,7 +57,7 @@ def fetch_client(client):
|
||||
if client == current_app.config.get('ADMIN_CLIENT_USER_NAME'):
|
||||
return {
|
||||
"client": client,
|
||||
"secret": current_app.config.get('ADMIN_CLIENT_SECRET')
|
||||
"secret": [current_app.config.get('ADMIN_CLIENT_SECRET')]
|
||||
}
|
||||
else:
|
||||
return {
|
||||
|
||||
@@ -85,10 +85,6 @@ def renew_api_key(service_id=None):
|
||||
return jsonify(result="error", message="Service not found"), 404
|
||||
|
||||
try:
|
||||
service_api_key = get_model_api_keys(service_id=service_id, raise_=False)
|
||||
if service_api_key:
|
||||
# expire existing api_key
|
||||
save_model_api_key(service_api_key, update_dict={'id': service_api_key.id, 'expiry_date': datetime.now()})
|
||||
# create a new one
|
||||
# TODO: what validation should be done here?
|
||||
secret_name = request.get_json()['name']
|
||||
|
||||
Reference in New Issue
Block a user