0002-misc-remove-dead-code-for-avoid_consent-signal-69992.patch
src/authentic2/idp/saml/saml2_endpoints.py | ||
---|---|---|
63 | 63 |
from authentic2.attributes_ng.engine import get_attributes |
64 | 64 |
from authentic2.compat_lasso import lasso |
65 | 65 |
from authentic2.constants import NONCE_FIELD_NAME |
66 |
from authentic2.idp import signals as idp_signals |
|
67 | 66 |
from authentic2.idp.saml.common import kill_django_sessions |
68 | 67 |
from authentic2.saml import saml2utils |
69 | 68 |
from authentic2.saml.common import ( |
... | ... | |
898 | 897 |
except ObjectDoesNotExist: |
899 | 898 |
logger.debug('consent not yet given (no existing federation) for %s', login.remoteProviderId) |
900 | 899 | |
901 |
if not consent_obtained and not transient: |
|
902 |
logger.debug('signal avoid_consent sent') |
|
903 |
avoid_consent = idp_signals.avoid_consent.send( |
|
904 |
sender=None, request=request, user=request.user, audience=login.remoteProviderId |
|
905 |
) |
|
906 |
for c in avoid_consent: |
|
907 |
logger.debug('avoid_consent connected to function %s', c[0].__name__) |
|
908 |
if c[1] and 'avoid_consent' in c[1] and c[1]['avoid_consent']: |
|
909 |
logger.debug('avoid consent by signal') |
|
910 |
consent_obtained = True |
|
911 |
# The user consent is bypassed by the signal |
|
912 |
consent_value = 'urn:oasis:names:tc:SAML:2.0:consent:unspecified' |
|
913 | ||
914 | 900 |
if not consent_obtained and not transient: |
915 | 901 |
logger.debug('ask the user consent now') |
916 | 902 |
return need_consent_for_federation(request, login, nid_format) |
src/authentic2/idp/signals.py | ||
---|---|---|
1 |
# authentic2 - versatile identity manager |
|
2 |
# Copyright (C) 2010-2019 Entr'ouvert |
|
3 |
# |
|
4 |
# This program is free software: you can redistribute it and/or modify it |
|
5 |
# under the terms of the GNU Affero General Public License as published |
|
6 |
# by the Free Software Foundation, either version 3 of the License, or |
|
7 |
# (at your option) any later version. |
|
8 |
# |
|
9 |
# This program is distributed in the hope that it will be useful, |
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
# GNU Affero General Public License for more details. |
|
13 |
# |
|
14 |
# You should have received a copy of the GNU Affero General Public License |
|
15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | ||
17 |
from django.dispatch import Signal |
|
18 | ||
19 |
# avoid_consent |
|
20 |
# Expect a boolean e.g. dic['avoid_consent'] = True or False |
|
21 |
avoid_consent = Signal(providing_args=["request", "user", "audience"]) |
|
22 |
- |