Skip to content
Snippets Groups Projects
  1. Apr 27, 2021
  2. Apr 22, 2021
  3. Apr 13, 2021
  4. Apr 09, 2021
  5. Apr 07, 2021
    • Antoine Lambert's avatar
      django/backends: Improve expired token handling · 309118c1
      Antoine Lambert authored
      The first time a user sends an expired token previously used to
      perform authenticated Web API calls, Keycloak will return the
      following error message: "Offline session not active".
      
      So handle that error message too for indicating a token has expired.
      
      Related to T3121
      v0.5.2
      309118c1
    • Antoine Lambert's avatar
      django/backends: Improve error message when a bearer token expired · d06924ed
      Antoine Lambert authored
      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
      v0.5.1
      d06924ed
  6. Apr 06, 2021
  7. Mar 30, 2021
    • Antoine Lambert's avatar
      django: Add OIDCSessionExpiredMiddleware · e5fd97a7
      Antoine Lambert authored
      That middleware detects when a user previously logged in using
      the OpenID Connect authentication backend got his session expired.
      
      In that case it will perform a redirection to a django view whose
      name must be set in the SWH_AUTH_SESSION_EXPIRED_REDIRECT_VIEW
      django setting (typically a logout view).
      
      Related to T3150
      v0.5.0
      e5fd97a7
    • Antoine Lambert's avatar
      django: Add OIDC Bearer Token authentication backend for DRF views · 0c8c3ce7
      Antoine Lambert authored
      Add a generic Django REST Framework authentication backend enabling to
      authenticate a user using Keycloak and OpenID Connect bearer tokens.
      
      The backend can be easily plugged into a DRF application by:
      
        * adding "swh.auth.django.backends.OIDCBearerTokenAuthentication"
          to the REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"]
          django setting.
      
        * configuring Keycloak URL, realm and client by adding
          SWH_AUTH_SERVER_URL, SWH_AUTH_REALM_NAME and SWH_AUTH_CLIENT_ID
          in django settings
      
      Users will then be able to perform authenticated Web API calls by
      sending their refresh token in HTTP Authorization headers.
      
      Related to T3150
      0c8c3ce7
    • Antoine Lambert's avatar
      django: Add OIDC Authorization code PKCE authentication backend · 367ead11
      Antoine Lambert authored
      Add a generic Django authentication backend and related login / logout
      views enabling to authenticate a user using Keycloak and the OpenID
      Connect authorization code flow with PKCE ("Proof Key for Code Exchange").
      
      The backend can be easily plugged into any django application by:
      
       - adding "swh.auth.django.backends.OIDCAuthorizationCodePKCEBackend"
         to the AUTHENTICATION_BACKENDS django setting
      
       - configuring Keycloak by adding SWH_AUTH_SERVER_URL, SWH_AUTH_REALM_NAME
         and SWH_AUTH_CLIENT_ID in django settings
      
       - adding swh.auth.django.views.urlpatterns to the django application URLs
      
       - using the dedicated django views: "oidc-login" and "oidc-logout"
      
      Related to T3150
      367ead11
  8. Mar 26, 2021
  9. Mar 25, 2021
  10. Mar 24, 2021
  11. Mar 23, 2021
  12. Mar 22, 2021
  13. Mar 18, 2021
  14. Mar 17, 2021
    • Antoine Lambert's avatar
      django/utils: Get access token renewal date from proper dict field · 679c0a5e
      Antoine Lambert authored
      In the dictionary decoded from an OIDC access token, the iat field store
      the token creation date while the auth_time field store the date the
      OIDC session was opened.
      
      In order to get an accurate authentication time, the date stored in
      the iat field must be used as it corresponds to the time an access
      token was refreshed and thus the latest valid authentication date.
      679c0a5e
  15. Mar 15, 2021
  16. Mar 12, 2021
  17. Mar 11, 2021
    • Antoine R. Dumont's avatar
      swh.auth.pytest_plugin: Make decoded_token consistent with user_info · acf199d6
      Antoine R. Dumont authored
      Tester will want to craft carefully the keycloak mock so it returns
      consistent data.
      
      Currently the decoded_token and user_info are hard-coded to consistent values. So using
      the default keycloak mock is ok. As soon as other testers will want another user_info,
      the decoded token will diverge and not return the correct user_info subpart of the
      decoded token.
      
      This commits fixes such behavior and allows the decoded token to stay consistent with
      the user_info.
      
      Related to T2858
  18. Mar 09, 2021
  19. Mar 05, 2021
  20. Mar 04, 2021
Loading