Rename setting.

This commit is contained in:
juanifioren 2015-06-24 12:40:00 -03:00
parent 4021441c76
commit 197818566d
6 changed files with 20 additions and 20 deletions

View file

@ -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.

10
DOC.md
View file

@ -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

View file

@ -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,

View file

@ -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()

View file

@ -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'],

View file

@ -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()