From 3a40e50fa0aa470860bf4387434600473125b2eb Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 19 Jun 2020 20:19:31 +0200 Subject: [PATCH] providers/oidc: add template for consent --- .../templates/providers/oidc/consent.html | 20 +++++++++++++++++++ passbook/providers/oidc/views.py | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 passbook/providers/oidc/templates/providers/oidc/consent.html diff --git a/passbook/providers/oidc/templates/providers/oidc/consent.html b/passbook/providers/oidc/templates/providers/oidc/consent.html new file mode 100644 index 000000000..83ad45123 --- /dev/null +++ b/passbook/providers/oidc/templates/providers/oidc/consent.html @@ -0,0 +1,20 @@ +{% extends 'login/form_with_user.html' %} + +{% load i18n %} + +{% block beneath_form %} +
+

+ {% blocktrans with name=context.application.name %} + You're about to sign into {{ name }}. + {% endblocktrans %} +

+

{% trans "Application requires following permissions" %}

+ + {{ hidden_inputs }} +
+{% endblock %} diff --git a/passbook/providers/oidc/views.py b/passbook/providers/oidc/views.py index abc0039ca..1cddbe524 100644 --- a/passbook/providers/oidc/views.py +++ b/passbook/providers/oidc/views.py @@ -1,4 +1,5 @@ """passbook OIDC Views""" +from passbook.stages.consent.stage import PLAN_CONTEXT_CONSENT_TEMPLATE from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpRequest, HttpResponse, JsonResponse @@ -27,7 +28,7 @@ from passbook.providers.oidc.models import OpenIDProvider LOGGER = get_logger() PLAN_CONTEXT_PARAMS = "params" - +PLAN_CONTEXT_SCOPES = "scopes" class AuthorizationFlowInitView(AccessMixin, LoginRequiredMixin, View): """OIDC Flow initializer, checks access to application and starts flow""" @@ -59,6 +60,8 @@ class AuthorizationFlowInitView(AccessMixin, LoginRequiredMixin, View): PLAN_CONTEXT_SSO: True, PLAN_CONTEXT_APPLICATION: application, PLAN_CONTEXT_PARAMS: endpoint.params, + PLAN_CONTEXT_SCOPES: endpoint.get_scopes_information(), + PLAN_CONTEXT_CONSENT_TEMPLATE: "providers/oidc/consent.html" }, ) plan.append(in_memory_stage(OIDCStage))