diff --git a/CHANGELOG.md b/CHANGELOG.md index 6432fb5..b4d4247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,8 @@ All notable changes to this project will be documented in this file. ### [Unreleased] ##### Added -- Way of remember user consent and skipt it (OIDC_USER_CONSENT_ENABLE). -- Setting OIDC_USER_CONSENT_EXPIRE. +- Way of remember user consent and skipt it (OIDC_SKIP_CONSENT_ENABLE). +- Setting OIDC_SKIP_CONSENT_EXPIRE. ##### Changed - Now OIDC_EXTRA_SCOPE_CLAIMS must be a string, to be lazy imported. diff --git a/DOC.md b/DOC.md index 4dd62d8..cf35ae6 100644 --- a/DOC.md +++ b/DOC.md @@ -3,7 +3,7 @@ Django OIDC Provider can help you providing out of the box all the endpoints, data and logic needed to add OpenID Connect capabilities to your Django projects. -**This project is still in DEVELOPMENT and is rapidly changing. DO NOT USE IT FOR PRODUCTION SITES, unless you know what you do.** +**This project is still in DEVELOPMENT and is rapidly changing.** **************************************** @@ -25,9 +25,9 @@ Before getting started there are some important things that you should know: - [OIDC_EXTRA_SCOPE_CLAIMS](#oidc_extra_scope_claims) - [OIDC_IDTOKEN_EXPIRE](#oidc_idtoken_expire) - [OIDC_IDTOKEN_SUB_GENERATOR](#oidc_idtoken_sub_generator) + - [OIDC_SKIP_CONSENT_ENABLE](#oidc_skip_consent_enable) + - [OIDC_SKIP_CONSENT_EXPIRE](#oidc_skip_consent_expire) - [OIDC_TOKEN_EXPIRE](#oidc_token_expire) - - [OIDC_USER_CONSENT_ENABLE](#oidc_user_consent_enable) - - [OIDC_USER_CONSENT_EXPIRE](#oidc_user_consent_expire) - [Users And Clients](#users-and-clients) - [Templates](#templates) - [Server Endpoints](#server-endpoints) @@ -35,8 +35,8 @@ Before getting started there are some important things that you should know: ## Requirements -- Python 2.7.*. -- Django 1.7.*. +- Python: `2.7.*` +- Django: `1.7.*` `1.8.*` ## Installation diff --git a/oidc_provider/lib/endpoints/authorize.py b/oidc_provider/lib/endpoints/authorize.py index 9236b02..9d6096e 100644 --- a/oidc_provider/lib/endpoints/authorize.py +++ b/oidc_provider/lib/endpoints/authorize.py @@ -148,7 +148,7 @@ class AuthorizeEndpoint(object): Return None. """ expires_at = timezone.now() + timedelta( - days=settings.get('OIDC_USER_CONSENT_EXPIRE')) + days=settings.get('OIDC_SKIP_CONSENT_EXPIRE')) uc, created = UserConsent.objects.get_or_create( user=self.request.user, diff --git a/oidc_provider/settings.py b/oidc_provider/settings.py index 9533f93..073a37f 100644 --- a/oidc_provider/settings.py +++ b/oidc_provider/settings.py @@ -61,26 +61,26 @@ class DefaultSettings(object): return default_sub_generator @property - def OIDC_TOKEN_EXPIRE(self): - """ - OPTIONAL. - """ - return 60*60 - - @property - def OIDC_USER_CONSENT_ENABLE(self): + def OIDC_SKIP_CONSENT_ENABLE(self): """ OPTIONAL. """ return True @property - def OIDC_USER_CONSENT_EXPIRE(self): + def OIDC_SKIP_CONSENT_EXPIRE(self): """ OPTIONAL. """ return 30*3 + @property + def OIDC_TOKEN_EXPIRE(self): + """ + OPTIONAL. + """ + return 60*60 + default_settings = DefaultSettings() diff --git a/oidc_provider/tests/test_authorize_endpoint.py b/oidc_provider/tests/test_authorize_endpoint.py index 0ca17c4..d38988a 100644 --- a/oidc_provider/tests/test_authorize_endpoint.py +++ b/oidc_provider/tests/test_authorize_endpoint.py @@ -244,10 +244,10 @@ class AuthorizationCodeFlowTestCase(TestCase): # Ensure user consent skip is enabled. OIDC_AFTER_USERLOGIN_HOOK = settings.default_settings.OIDC_AFTER_USERLOGIN_HOOK - OIDC_USER_CONSENT_ENABLE = settings.default_settings.OIDC_USER_CONSENT_ENABLE + OIDC_SKIP_CONSENT_ENABLE = settings.default_settings.OIDC_SKIP_CONSENT_ENABLE with self.settings( OIDC_AFTER_USERLOGIN_HOOK=OIDC_AFTER_USERLOGIN_HOOK, - OIDC_USER_CONSENT_ENABLE=OIDC_USER_CONSENT_ENABLE): + OIDC_SKIP_CONSENT_ENABLE=OIDC_SKIP_CONSENT_ENABLE): response = AuthorizeView.as_view()(request) is_code_ok = is_code_valid(url=response['Location'], diff --git a/oidc_provider/views.py b/oidc_provider/views.py index 6be5432..0f43245 100644 --- a/oidc_provider/views.py +++ b/oidc_provider/views.py @@ -34,7 +34,7 @@ class AuthorizeView(View): if hook_resp: return hook_resp - if settings.get('OIDC_USER_CONSENT_ENABLE'): + if settings.get('OIDC_SKIP_CONSENT_ENABLE'): # Check if user previously give consent. if authorize.client_has_user_consent(): uri = authorize.create_response_uri()