Page MenuHomeSoftware Heritage

django/backends: Improve error message when a bearer token expired
ClosedPublic

Authored by anlambert on Tue, Apr 6, 7:06 PM.

Details

Summary

This replaces the Keycloak error message by a more comprehensible one
for end users.

Unfortunately, there is no way to get the bearer token validity period
apart using Keycloak Admin REST API but we clearly do not want to query
it in a django auth backend.

Related to T3121

Diff Detail

Repository
rDAUTH Common authentication libraries
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

swh/auth/tests/django/test_views.py
248

forgot to remove that debug print, put in a separate commit

Build is green

Patch application report for D5431 (id=19412)

Rebasing onto e5fd97a758...

Current branch diff-target is up to date.
Changes applied before test
commit f29fa1c62fe50ac52c205679f25ab04e48aff2ef
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Apr 6 19:02:55 2021 +0200

    django/backends: Improve error message when a bearer token expired
    
    Related to T3121

commit 9d9a0a3357856d9b9498898261d2178b66c0343a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Apr 6 19:02:28 2021 +0200

    tests: Remove debug print

See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/67/ for more details.

ardumont added a subscriber: ardumont.

lgtm

Beware the keyclok typo in the diff description and most likely in your commit message
;)

This revision is now accepted and ready to land.Wed, Apr 7, 9:13 AM

lgtm

Beware the keyclok typo in the diff description and most likely in your commit message
;)

Nice catch, thanks !

Update commit message and prefer to override api_client fixture for resetting the django cache.

Build is green

Patch application report for D5431 (id=19417)

Rebasing onto e5fd97a758...

Current branch diff-target is up to date.
Changes applied before test
commit d06924ed0069549d1c5db3b38fc2cc8c0cfb807b
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Apr 6 19:02:55 2021 +0200

    django/backends: Improve error message when a bearer token expired
    
    This replaces the Keycloak error message by a more comprehensible one
    for end users.
    
    Unfortunately, there is no way to get the bearer token validity period
    apart using Keycloak Admin REST API but we clearly do not want to query
    it in a django authentication backend.
    
    Related to T3121

commit 9d9a0a3357856d9b9498898261d2178b66c0343a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Apr 6 19:02:28 2021 +0200

    tests: Remove debug print

See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/68/ for more details.