Giter Club home page Giter Club logo

Comments (3)

moritz89 avatar moritz89 commented on May 26, 2024

The relevant patch to fix the issue:

From 62ab0b96af3f150797c454527ed661e4bfa92c1e Mon Sep 17 00:00:00 2001
From: Moritz Ulmer <[email protected]>
Date: Tue, 14 Feb 2023 09:37:40 +0000
Subject: [PATCH] 507-fix-fetching-user-details-after-timeout

Why:

- Allow Keycloak admin queries to be made after initial deployment

This change addresses the need by:

- Refreshing tokens by default for all HTTP method calls in KC-admin

Closes #507
---
 src/django_keycloak/config.py    | 4 ++++
 src/django_keycloak/connector.py | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/django_keycloak/config.py b/src/django_keycloak/config.py
index b4a08f25..b3806bad 100644
--- a/src/django_keycloak/config.py
+++ b/src/django_keycloak/config.py
@@ -39,6 +39,10 @@ class Settings:
     USER_INFO_IN_TOKEN: Optional[bool] = True
     # Flag to show the traceback of debug logs
     TRACE_DEBUG_LOGS: Optional[bool] = False
+    # For the KeycloakAdmin, which HTTP methods to refresh the token for
+    AUTO_REFRESH_TOKEN: Optional[List[str]] = field(
+        default_factory=lambda: ["get", "put", "post", "delete"]
+    )
     # The token prefix
     TOKEN_PREFIX: Optional[str] = "Bearer"
     # Derived setting of the SERVER/INTERNAL_URL and BASE_PATH
diff --git a/src/django_keycloak/connector.py b/src/django_keycloak/connector.py
index d83e4173..26d00fac 100644
--- a/src/django_keycloak/connector.py
+++ b/src/django_keycloak/connector.py
@@ -76,4 +76,5 @@ lazy_keycloak_admin = LazyKeycloakAdmin(
     client_id=settings.CLIENT_ID,
     realm_name=settings.REALM,
     client_secret_key=settings.CLIENT_SECRET_KEY,
+    auto_refresh_token=settings.AUTO_REFRESH_TOKEN,
 )
-- 

from django-keycloak-auth.

github-actions avatar github-actions commented on May 26, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

from django-keycloak-auth.

github-actions avatar github-actions commented on May 26, 2024

This issue was closed because it has been stalled for 7 days with no activity.

from django-keycloak-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.