Skip to content
Draft
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
5 changes: 3 additions & 2 deletions invenio_oauthclient/contrib/cern.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2025 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -135,7 +136,7 @@

import copy
import re
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from warnings import warn

from flask import Blueprint, current_app, flash, g, redirect, session, url_for
Expand All @@ -158,7 +159,7 @@
from invenio_oauthclient.oauth import oauth_link_external_id, oauth_unlink_external_id
from invenio_oauthclient.proxies import current_oauthclient

warn(

Check warning on line 162 in invenio_oauthclient/contrib/cern.py

View workflow job for this annotation

GitHub Actions / Tests / Tests (3.9, postgresql14, opensearch2)

The cern contrib is deprecated. Please use the generic keycloak instead.

Check warning on line 162 in invenio_oauthclient/contrib/cern.py

View workflow job for this annotation

GitHub Actions / Tests / Tests (3.12, postgresql14, opensearch2)

The cern contrib is deprecated. Please use the generic keycloak instead.
"The cern contrib is deprecated. Please use the generic keycloak instead.",
DeprecationWarning,
)
Expand Down Expand Up @@ -332,7 +333,7 @@

def account_groups_and_extra_data(account, resource, refresh_timedelta=None):
"""Fetch account groups and extra data from resource if necessary."""
updated = datetime.utcnow()
updated = datetime.now(timezone.utc)
modified_since = updated
if refresh_timedelta is not None:
modified_since += refresh_timedelta
Expand Down
5 changes: 3 additions & 2 deletions invenio_oauthclient/contrib/cern_openid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2015-2023 CERN.
# Copyright (C) 2025 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -64,7 +65,7 @@
</a>
"""

from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

from flask import Blueprint, current_app, flash, g, redirect, session, url_for
from flask_login import current_user
Expand Down Expand Up @@ -187,7 +188,7 @@ def fetch_extra_data(resource):

def account_roles_and_extra_data(account, resource, refresh_timedelta=None):
"""Fetch account roles and extra data from resource if necessary."""
updated = datetime.utcnow()
updated = datetime.now(timezone.utc)
modified_since = updated
if refresh_timedelta is not None:
modified_since += refresh_timedelta
Expand Down
Loading