idp_oidc: display service info on authorization page (#64672)

This commit is contained in:
Serghei Mihai 2022-05-09 15:10:57 +02:00
parent 7de36f8910
commit 0a79c4ded1
3 changed files with 21 additions and 6 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Authentic\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-06 10:46+0200\n"
"POT-Creation-Date: 2022-05-09 14:18+0200\n"
"PO-Revision-Date: 2022-04-06 10:49+0200\n"
"Last-Translator: Benjamin Dauvergne <bdauvergne@entrouvert.com>\n"
"Language-Team: None\n"
@ -232,9 +232,8 @@ msgid "Authentication access check"
msgstr "Vérification dautorisation daccès"
#: src/authentic2_idp_oidc/templates/authentic2_idp_oidc/authorization.html
#, python-format
msgid "Do you want to be authenticated on service %(client_name)s ?"
msgstr "Souhaitez-vous être authentifié sur le service %(client_name)s ?"
msgid "Do you want to be authenticated on this service ?"
msgstr "Souhaitez-vous être authentifié sur ce service ?"
#: src/authentic2_idp_oidc/templates/authentic2_idp_oidc/authorization.html
msgid "The following informations will be sent to the service:"

View File

@ -6,10 +6,14 @@
<link rel="stylesheet" type="text/css" href="{% static 'authentic2_idp_oidc/css/style.css' %}"></link>
{% endblock %}
{% block beforecontent %}
{% include "authentic2/service_info_fragment.html" %}
{% endblock %}
{% block content %}
<h2>{% trans "Authentication access check" %}</h2>
<form method="post" id="a2-oidc-authorization-form">
<p>{% blocktrans with client_name=client.name %}Do you want to be authenticated on service {{ client_name }} ?{% endblocktrans %}</p>
<p>{% trans "Do you want to be authenticated on this service ?" %}</p>
{% if needs_scope_validation %}
<p>{% trans "The following informations will be sent to the service:" %}</p>
<ul>

View File

@ -130,7 +130,7 @@ def test_admin(other_attributes, app, superuser, oidc_settings):
assert OIDCClient.objects.count() == 1
def test_login_from_client_with_home_url(oidc_client, app):
def test_login_from_client_with_home_url(oidc_client, app, simple_user):
redirect_uri = oidc_client.redirect_uris.split()[0]
params = {
'client_id': oidc_client.client_id,
@ -185,6 +185,18 @@ def test_login_from_client_with_home_url(oidc_client, app):
== '/media/services/logos/201x201.jpg'
)
# check authorization page
response = utils.login(app, simple_user)
response = app.get(authorize_url)
assert response.pyquery.find('.service-message')
assert response.pyquery.find('a.service-message--link')
assert (
response.pyquery.find('img.service-message--logo')[0].attrib['src']
== '/media/services/logos/201x201.jpg'
)
link = response.pyquery.find('a.service-message--link')[0]
assert link.attrib['href'] == 'https://service.example.net'
@pytest.mark.parametrize('oidc_client', OIDC_CLIENT_PARAMS, indirect=True)
@pytest.mark.parametrize('do_not_ask_again', [(True,), (False,)])