Add initial signals logic.
This commit is contained in:
parent
8d77634417
commit
5242f0841e
6
oidc_provider/signals.py
Normal file
6
oidc_provider/signals.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from django.dispatch import Signal
|
||||||
|
|
||||||
|
|
||||||
|
user_accept_consent = Signal(providing_args=['user', 'client', 'scope'])
|
||||||
|
user_decline_consent = Signal(providing_args=['user', 'client', 'scope'])
|
|
@ -42,6 +42,7 @@ from oidc_provider.models import (
|
||||||
RSAKey,
|
RSAKey,
|
||||||
)
|
)
|
||||||
from oidc_provider import settings
|
from oidc_provider import settings
|
||||||
|
from oidc_provider import signals
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -131,10 +132,14 @@ class AuthorizeView(View):
|
||||||
authorize.validate_params()
|
authorize.validate_params()
|
||||||
|
|
||||||
if not request.POST.get('allow'):
|
if not request.POST.get('allow'):
|
||||||
|
signals.user_decline_consent.send(self.__class__, user=request.user, client=authorize.client, scope=authorize.params['scope'])
|
||||||
|
|
||||||
raise AuthorizeError(authorize.params['redirect_uri'],
|
raise AuthorizeError(authorize.params['redirect_uri'],
|
||||||
'access_denied',
|
'access_denied',
|
||||||
authorize.grant_type)
|
authorize.grant_type)
|
||||||
|
|
||||||
|
signals.user_accept_consent.send(self.__class__, user=request.user, client=authorize.client, scope=authorize.params['scope'])
|
||||||
|
|
||||||
# Save the user consent given to the client.
|
# Save the user consent given to the client.
|
||||||
authorize.set_client_user_consent()
|
authorize.set_client_user_consent()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue