Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20454 - Add test logs #1493

Merged
merged 7 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pay-queue/devops/vaults.gcp.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PUBLISHER_AUDIENCE="op://gcp-queue/$APP_ENV/base/PUBLISHER_AUDIENCE"
PAY_SUB_AUDIENCE="op://gcp-queue/$APP_ENV/base/PAY_SUB_AUDIENCE"
VERIFY_PUBSUB_EMAIL="op://gcp-queue/$APP_ENV/base/VERIFY_PUBSUB_EMAIL"
VERIFY_PUBSUB_VIA_JWT="op://gcp-queue/$APP_ENV/base/VERIFY_PUBSUB_VIA_JWT"
DEBUG_REQUEST="op://gcp-queue/$APP_ENV/base/DEBUG_REQUEST"
ACCOUNT_MAILER_TOPIC="op://gcp-queue/$APP_ENV/topics/ACCOUNT_MAILER_TOPIC"
SENTRY_ENABLE="op://sentry/$APP_ENV/relationship-api/SENTRY_ENABLE"
SENTRY_DSN="op://sentry/$APP_ENV/relationship-api/SENTRY_DSN"
Expand Down
4 changes: 3 additions & 1 deletion pay-queue/src/pay_queue/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class _Config(): # pylint: disable=too-few-public-methods
ACCOUNT_MAILER_TOPIC = os.getenv('ACCOUNT_MAILER_TOPIC', None)
PAY_SUB_AUDIENCE = os.getenv('PAY_SUB_AUDIENCE', None)
VERIFY_PUBSUB_EMAIL = os.getenv('VERIFY_PUBSUB_EMAIL', None)
VERIFY_PUBSUB_VIA_JWT = os.getenv('VERIFY_PUBSUB_VIA_JWT', None)

VERIFY_PUBSUB_VIA_JWT = os.getenv('VERIFY_PUBSUB_VIA_JWT', 'true').lower() == 'true'
VERIFY_PUBSUB_VIA_JWT = os.getenv('DEBUG_REQUEST', 'true').lower() == 'true'


class DevConfig(_Config): # pylint: disable=too-few-public-methods
Expand Down
7 changes: 5 additions & 2 deletions pay-queue/src/pay_queue/external/gcp_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ def ensure_authorized_queue_user(f):
@functools.wraps(f)
def decorated_function(*args, **kwargs):
# Use CacheControl to avoid re-fetching certificates for every request.
config_value = current_app.config.get('VERIFY_PUBSUB_VIA_JWT', True)
if config_value is True:
if current_app.config.get('DEBUG_REQUEST') is True:
current_app.logger.info(f'Headers: {request.headers}')
verifyJWT = current_app.config.get('VERIFY_PUBSUB_VIA_JWT', True)
current_app.logger.info(f'verifyJWT: {verifyJWT}')
if verifyJWT is True:
if message := verify_jwt(CacheControl(Session())):
abort(HTTPStatus.UNAUTHORIZED)
return f(*args, **kwargs)
Expand Down
Loading