mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-29 17:08:21 -04:00
Add more admin api endpoints
This commit is contained in:
@@ -132,8 +132,9 @@ def _decode_jwt_token(auth_token, api_keys, service_id=None):
|
||||
try:
|
||||
decode_jwt_token(auth_token, api_key.secret)
|
||||
except TokenExpiredError:
|
||||
err_msg = "Error: Your system clock must be accurate to within 30 seconds"
|
||||
raise AuthError(err_msg, 403, service_id=service_id, api_key_id=api_key.id)
|
||||
if not current_app.config.get('ALLOW_EXPIRED_API_TOKEN', False):
|
||||
err_msg = "Error: Your system clock must be accurate to within 30 seconds"
|
||||
raise AuthError(err_msg, 403, service_id=service_id, api_key_id=api_key.id)
|
||||
except TokenAlgorithmError:
|
||||
err_msg = "Invalid token: algorithm used is not HS256"
|
||||
raise AuthError(err_msg, 403, service_id=service_id, api_key_id=api_key.id)
|
||||
|
||||
@@ -80,6 +80,7 @@ class Config(object):
|
||||
('{"%s":["%s"]}' % (ADMIN_CLIENT_ID, getenv('ADMIN_CLIENT_SECRET')))
|
||||
)
|
||||
)
|
||||
ALLOW_EXPIRED_API_TOKEN = False
|
||||
# encyption secret/salt
|
||||
SECRET_KEY = getenv('SECRET_KEY')
|
||||
DANGEROUS_SALT = getenv('DANGEROUS_SALT')
|
||||
@@ -368,6 +369,7 @@ class Development(Config):
|
||||
DANGEROUS_SALT = 'dev-notify-salt'
|
||||
SECRET_KEY = 'dev-notify-secret-key' # nosec B105 - this is only used in development
|
||||
INTERNAL_CLIENT_API_KEYS = {Config.ADMIN_CLIENT_ID: ['dev-notify-secret-key']}
|
||||
ALLOW_EXPIRED_API_TOKEN = getenv('ALLOW_EXPIRED_API_TOKEN', '0') == '1'
|
||||
|
||||
|
||||
class Test(Development):
|
||||
|
||||
Reference in New Issue
Block a user