diff --git a/CHANGES.md b/CHANGES.md index 2c00fa6..603fa1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ Changelog ========= +1.0.1 (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/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' 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 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 = [