Skip to content

Commit

Permalink
Merge pull request #853 from asfadmin/rew/pr-3242-reduce-edl-calls
Browse files Browse the repository at this point in the history
PR-3242 Improve handling of JWT bearer tokens
  • Loading branch information
reweeden authored Jan 10, 2025
2 parents c4e4285 + d9e2af9 commit 3e03634
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 121 deletions.
3 changes: 2 additions & 1 deletion requirements/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
cachetools
cfnresponse
chalice
git+https://github.com/asfadmin/rain-api-core.git@1be67560f7c41b50afbd2ca20473ffbdc7efae68
git+https://github.com/asfadmin/rain-api-core.git@8d241610b50299198aa0cc210852259fef9e482b
netaddr
pyjwt
6 changes: 4 additions & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ netaddr==1.3.0
pycparser==2.22
# via cffi
pyjwt[crypto]==2.10.1
# via rain-api-core
# via
# -r requirements/requirements.in
# rain-api-core
python-dateutil==2.9.0.post0
# via botocore
pyyaml==6.0.2
# via
# chalice
# rain-api-core
rain-api-core @ git+https://github.com/asfadmin/rain-api-core.git@1be67560f7c41b50afbd2ca20473ffbdc7efae68
rain-api-core @ git+https://github.com/asfadmin/rain-api-core.git@8d241610b50299198aa0cc210852259fef9e482b
# via -r requirements/requirements.in
readchar==4.2.1
# via inquirer
Expand Down
20 changes: 20 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import textwrap
from pathlib import Path

import boto3
Expand All @@ -26,6 +27,25 @@ def aws_credentials():
os.environ["AWS_DEFAULT_REGION"] = "us-east-1"


@pytest.fixture(scope="session")
def private_key():
"""Used for signing fake JWTs in unit tests"""
return textwrap.dedent(
"""
-----BEGIN PRIVATE KEY-----
MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAzXKhtCOkUvA5POUW
ddN8G0wHTQfQg6wp7NXmID8AW0FMU5ZOhAl0l1dGWs9U83C4IA8Hqbpe/XbY8CuT
SOEWUwIDAQABAkAU5/5Wg238Vp+sd69ybAPsDy+LAimQzJszk4yoaWDS6EI1DcBV
npb7lFvGCcnUe57Lm6DhWD1EnDYhD451VrYRAiEA/8z3pXYDBSJoWA79xrsq2cze
4oYwhTWtzueU8+Mlf0kCIQDNm55qR00BUbhBO/tTP2VCC2OQd/v9I+UIcwIL9Wg8
uwIhAOpwUAe1QM9T2Y3bL3sTzxIOUbgKhC2SJNmcJUfgxl0BAiEAq+nbageV9m1q
v3i0qqWON8uoAyqfkshJf2gSJQebkXMCIFUVSih1R6FqkoP2HFOZvJiRQnfO6shL
jrhQOs2SXP05
-----END PRIVATE KEY-----
""",
)


@pytest.fixture(scope="session")
def data_path():
return Path(__file__).parent.joinpath("data").resolve()
Expand Down
Loading

0 comments on commit 3e03634

Please sign in to comment.