Merge pull request #279 from ByteInternet/make_authorization_endpoint_and_client_more_easily_adjustable
Make it easier to change AuthorizeEndpoint and Client
This commit is contained in:
commit
458eb2e3ea
2 changed files with 5 additions and 3 deletions
|
@ -37,6 +37,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class AuthorizeEndpoint(object):
|
class AuthorizeEndpoint(object):
|
||||||
_allowed_prompt_params = {'none', 'login', 'consent', 'select_account'}
|
_allowed_prompt_params = {'none', 'login', 'consent', 'select_account'}
|
||||||
|
client_class = Client
|
||||||
|
|
||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
self.request = request
|
self.request = request
|
||||||
|
@ -86,7 +87,7 @@ class AuthorizeEndpoint(object):
|
||||||
def validate_params(self):
|
def validate_params(self):
|
||||||
# Client validation.
|
# Client validation.
|
||||||
try:
|
try:
|
||||||
self.client = Client.objects.get(client_id=self.params['client_id'])
|
self.client = self.client_class.objects.get(client_id=self.params['client_id'])
|
||||||
except Client.DoesNotExist:
|
except Client.DoesNotExist:
|
||||||
logger.debug('[Authorize] Invalid client identifier: %s', self.params['client_id'])
|
logger.debug('[Authorize] Invalid client identifier: %s', self.params['client_id'])
|
||||||
raise ClientIdError()
|
raise ClientIdError()
|
||||||
|
|
|
@ -61,9 +61,10 @@ OIDC_TEMPLATES = settings.get('OIDC_TEMPLATES')
|
||||||
|
|
||||||
|
|
||||||
class AuthorizeView(View):
|
class AuthorizeView(View):
|
||||||
def get(self, request, *args, **kwargs):
|
authorize_endpoint_class = AuthorizeEndpoint
|
||||||
|
|
||||||
authorize = AuthorizeEndpoint(request)
|
def get(self, request, *args, **kwargs):
|
||||||
|
authorize = self.authorize_endpoint_class(request)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
authorize.validate_params()
|
authorize.validate_params()
|
||||||
|
|
Loading…
Reference in a new issue