Skip to content

Commit

Permalink
Merge pull request #954 from lsst-sqre/u/rra/dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
rra authored Jan 30, 2024
2 parents 593ad78 + d6e5071 commit 039eb2d
Show file tree
Hide file tree
Showing 7 changed files with 430 additions and 516 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.1.15
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -27,7 +27,7 @@ repos:
hooks:
- id: eslint
additional_dependencies:
- '@babel/[email protected].3'
- '@babel/[email protected].9'
- '@babel/[email protected]'
- [email protected]
- [email protected]
Expand Down
316 changes: 145 additions & 171 deletions requirements/dev.txt

Large diffs are not rendered by default.

358 changes: 166 additions & 192 deletions requirements/main.txt

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/gafaelfawr/services/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,18 @@ async def issue_id_token(
# list of claims that were requested via either claims or scopes and
# by dropping any claims that were None.
now = current_datetime()
if token_data.expires:
expires = token_data.expires.timestamp()
else:
expires = (now + self._config.lifetime).timestamp()
payload: dict[str, Any] = {
"aud": authorization.client_id,
"auth_time": int(token_data.created.timestamp()),
"data_rights": self._build_data_rights_for_user(user_info),
"iat": int(now.timestamp()),
"iss": str(self._config.issuer),
"email": user_info.email,
"exp": int(token_data.expires.timestamp()),
"exp": expires,
"jti": authorization.code.key,
"name": user_info.name,
"nonce": authorization.nonce,
Expand Down
4 changes: 4 additions & 0 deletions tests/handlers/oidc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ async def test_login(
)
assert config.oidc_server
token_data = await create_session_token(factory)
assert token_data.expires
await set_session_cookie(client, token_data.token)

# Authenticate.
Expand Down Expand Up @@ -806,6 +807,7 @@ async def test_nonce(
)
assert config.oidc_server
token_data = await create_session_token(factory)
assert token_data.expires
await set_session_cookie(client, token_data.token)
nonce = os.urandom(16).hex()

Expand Down Expand Up @@ -852,6 +854,7 @@ async def test_data_rights(
)
assert config.oidc_server
token_data = await create_session_token(factory, group_names=["foo"])
assert token_data.expires
await set_session_cookie(client, token_data.token)

token = await authenticate(
Expand Down Expand Up @@ -879,6 +882,7 @@ async def test_data_rights(
}

token_data = await create_session_token(factory, group_names=["admin"])
assert token_data.expires
await set_session_cookie(client, token_data.token)

token = await authenticate(
Expand Down
1 change: 1 addition & 0 deletions tests/services/oidc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ async def test_issue_id_token(tmp_path: Path, factory: Factory) -> None:
oidc_service = factory.create_oidc_service()

token_data = await create_session_token(factory)
assert token_data.expires
authorization = OIDCAuthorization(
client_id="some-id",
redirect_uri=redirect_uri,
Expand Down
Loading

0 comments on commit 039eb2d

Please sign in to comment.