From 7d3b5ada2bb56dc79ca4065bb91b04cdbfb1bf1c Mon Sep 17 00:00:00 2001 From: seungmin paik Date: Fri, 11 Oct 2019 10:37:15 +0900 Subject: [PATCH 1/4] =?UTF-8?q?lib=EC=97=90=EC=84=9C=20ridi=5Fdjango=5Foau?= =?UTF-8?q?th2=5Flib=20=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/decorators/memorize.py | 28 ------------------- .../decorators/retry.py | 0 .../utils/bytes.py | 0 ridi_oauth2/introspector/dtos.py | 2 +- ridi_oauth2/introspector/key_handler.py | 2 +- 5 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 lib/decorators/memorize.py rename {lib => ridi_django_oauth2_lib}/decorators/retry.py (100%) rename {lib => ridi_django_oauth2_lib}/utils/bytes.py (100%) diff --git a/lib/decorators/memorize.py b/lib/decorators/memorize.py deleted file mode 100644 index 1e3d2ca..0000000 --- a/lib/decorators/memorize.py +++ /dev/null @@ -1,28 +0,0 @@ -import time -from typing import Callable - -DEFAULT_MEMORIZE_TIMEOUT = 60 - - -def memorize(timeout: int = DEFAULT_MEMORIZE_TIMEOUT): - def _wrapper(func: Callable): - _cache = {} - _timeouts = {} - - def _decorator(*args, clear: bool = False, **kwargs): - if clear: - return func(*args, **kwargs) - - key = func.__name__ + str(args) + str(kwargs) - if key not in _cache: - _timeouts[key] = time.time() - _cache[key] = func(*args, **kwargs) - - delta = time.time() - _timeouts[key] - if delta > timeout: - _timeouts[key] = time.time() - _cache[key] = func(*args, **kwargs) - - return _cache[key] - return _decorator - return _wrapper diff --git a/lib/decorators/retry.py b/ridi_django_oauth2_lib/decorators/retry.py similarity index 100% rename from lib/decorators/retry.py rename to ridi_django_oauth2_lib/decorators/retry.py diff --git a/lib/utils/bytes.py b/ridi_django_oauth2_lib/utils/bytes.py similarity index 100% rename from lib/utils/bytes.py rename to ridi_django_oauth2_lib/utils/bytes.py diff --git a/ridi_oauth2/introspector/dtos.py b/ridi_oauth2/introspector/dtos.py index d5a67f4..ad44c88 100644 --- a/ridi_oauth2/introspector/dtos.py +++ b/ridi_oauth2/introspector/dtos.py @@ -4,7 +4,7 @@ from Crypto.PublicKey import RSA -from lib.utils.bytes import bytes_to_int +from ridi_django_oauth2_lib.utils.bytes import bytes_to_int from ridi_oauth2.introspector.constants import JWK_EXPIRES_MIN diff --git a/ridi_oauth2/introspector/key_handler.py b/ridi_oauth2/introspector/key_handler.py index 2dcfd0e..f0a3889 100644 --- a/ridi_oauth2/introspector/key_handler.py +++ b/ridi_oauth2/introspector/key_handler.py @@ -3,7 +3,7 @@ import requests from requests import RequestException, Response -from lib.decorators.retry import RetryFailException, retry +from ridi_django_oauth2_lib.decorators.retry import RetryFailException, retry from ridi_django_oauth2.config import RidiOAuth2Config from ridi_oauth2.introspector.constants import JWKKeyType, JWKUse from ridi_oauth2.introspector.dtos import JWKDto From c797c2d460606cd1ae7e84c2a5e0026b83a0e0e0 Mon Sep 17 00:00:00 2001 From: seungmin paik Date: Fri, 11 Oct 2019 10:39:31 +0900 Subject: [PATCH 2/4] README updated --- README.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/README.md b/README.md index 29c1d16..e30faaf 100644 --- a/README.md +++ b/README.md @@ -28,18 +28,7 @@ AUTH_USER_MODEL = 'ridi_django_oauth2.RidiUser' # RIDI Setting -RIDI_OAUTH2_JWT_SECRETS = [ - { - 'kid': '0', - 'secret': 'this-is-hs256-key', - 'alg': 'HS256', - }, - { - 'kid': '1', - 'secret': 'this-is-rs256-public-key', - 'alg': 'RS256', - }, -] +RIDI_OAUTH2_KEY_URL = 'https://{auth_server_host}/oauth2/keys/public' RIDI_OAUTH2_CLIENT_ID = 'this-is-client-id' RIDI_OAUTH2_CLIENT_SECRET = 'this-is-client-secret' From d7d1dbbd4515fba7da6be6ab867ed956b651412a Mon Sep 17 00:00:00 2001 From: seungmin paik Date: Fri, 11 Oct 2019 10:41:01 +0900 Subject: [PATCH 3/4] version updated , changes added --- CHANGES.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 2c00fa6..5709733 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ Changelog ========= +1.0.0 (Oct 10st 2019) +------------------ +- Change lib dir to ridi_django_oauth2_lib for preventing dir conflict +- Update README.md + 1.0.0 (Oct 10st 2019) ------------------ - Change main logic to get public key from OAuth2 server diff --git a/setup.py b/setup.py index 09577f1..b9c768a 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -version = '1.0.0' +version = '1.0.1' # When the project is installed by pip, this is the specification that is used to install its dependencies. install_requires = [ From 10ded3c74da175bdf95dfeb37b49a51a153766c2 Mon Sep 17 00:00:00 2001 From: seungmin paik Date: Fri, 11 Oct 2019 10:42:04 +0900 Subject: [PATCH 4/4] change log fixed --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 5709733..603fa1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ Changelog ========= -1.0.0 (Oct 10st 2019) +1.0.1 (Oct 10st 2019) ------------------ - Change lib dir to ridi_django_oauth2_lib for preventing dir conflict - Update README.md