Skip to content

Commit 852827b

Browse files
authored
Merge pull request #11 from makinacorpus/drf_spectacular_support
Lazy client initialisation
2 parents fe2a59c + 155dd3e commit 852827b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

django_pyoidc/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.10
1+
0.0.11

django_pyoidc/drf/authentication.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import functools
12
import logging
23

34
from django.conf import settings
@@ -25,9 +26,12 @@ def __init__(self, *args, **kwargs):
2526
super(OIDCBearerAuthentication, self).__init__(*args, **kwargs)
2627
self.op_name = self.extract_drf_opname()
2728
self.general_cache_backend = OIDCCacheBackendForDjango(self.op_name)
28-
self.client = OIDCClient(self.op_name)
2929
self.engine = OIDCEngine(self.op_name)
3030

31+
@functools.cached_property
32+
def client(self):
33+
return OIDCClient(self.op_name)
34+
3135
@classmethod
3236
def extract_drf_opname(cls):
3337
"""

0 commit comments

Comments
 (0)