0001-middleware-disable-automatic-passive-authentication-.patch
mellon/middleware.py | ||
---|---|---|
37 | 37 |
return response |
38 | 38 | |
39 | 39 |
def process_view(self, request, view_func, view_args, view_kwargs): |
40 |
# skip if explicitely asked in the query string |
|
41 |
if 'noauth' in request.GET: |
|
42 |
return |
|
40 | 43 |
# Skip AJAX requests |
41 | 44 |
if request.is_ajax(): |
42 | 45 |
return |
tests/test_sso_slo.py | ||
---|---|---|
656 | 656 |
assert login_hints[0].text == 'backoffice', 'login hint is not backoffice' |
657 | 657 | |
658 | 658 | |
659 |
def test_middleware_mixin_first_time(db, app, idp, caplog, settings):
|
|
659 |
def test_passive_auth_middleware_ok(db, app, idp, caplog, settings):
|
|
660 | 660 |
settings.MELLON_OPENED_SESSION_COOKIE_NAME = 'IDP_SESSION' |
661 | 661 |
assert 'MELLON_PASSIVE_TRIED' not in app.cookies |
662 | 662 |
# webtest-lint is against unicode |
... | ... | |
688 | 688 |
assert 'MELLON_PASSIVE_TRIED' in app.cookies |
689 | 689 | |
690 | 690 | |
691 |
def test_passive_auth_middleware_noauth(db, app, idp, caplog, settings): |
|
692 |
settings.MELLON_OPENED_SESSION_COOKIE_NAME = 'IDP_SESSION' |
|
693 |
assert 'MELLON_PASSIVE_TRIED' not in app.cookies |
|
694 |
# webtest-lint is against unicode |
|
695 |
app.set_cookie(str('IDP_SESSION'), str('1')) |
|
696 |
app.get('/?noauth', headers={'Accept': force_str('text/html')}, status=200) |
|
697 | ||
698 | ||
691 | 699 |
def test_sso_user_change(db, app, idp, caplog, sp_settings): |
692 | 700 |
response = app.get(reverse('mellon_login') + '?next=/whatever/') |
693 | 701 |
url, body, relay_state = idp.process_authn_request_redirect(response['Location']) |
694 |
- |