core: make EndSessionView inherit PolicyAccessView
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
b55c3a687d
commit
90a5c84ac8
|
@ -1,5 +1,4 @@
|
|||
"""authentik URL Configuration"""
|
||||
from authentik.core.views.session import EndSessionView
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.urls import path
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
|
@ -8,6 +7,7 @@ from django.views.generic.base import TemplateView
|
|||
|
||||
from authentik.core.views import impersonate
|
||||
from authentik.core.views.interface import FlowInterfaceView
|
||||
from authentik.core.views.session import EndSessionView
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
|
|
|
@ -5,18 +5,20 @@ from django.shortcuts import get_object_or_404
|
|||
from django.views.generic.base import TemplateView
|
||||
|
||||
from authentik.core.models import Application
|
||||
from authentik.policies.views import PolicyAccessView
|
||||
|
||||
|
||||
class EndSessionView(TemplateView):
|
||||
class EndSessionView(TemplateView, PolicyAccessView):
|
||||
"""Allow the client to end the Session"""
|
||||
|
||||
template_name = "if/end_session.html"
|
||||
|
||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
context["application"] = get_object_or_404(
|
||||
def resolve_provider_application(self):
|
||||
self.application = get_object_or_404(
|
||||
Application, slug=self.kwargs["application_slug"]
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["application"] = self.application
|
||||
return context
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
{% endif %}
|
||||
{% if policy_result %}
|
||||
<hr>
|
||||
{% if policy_result.messages %}
|
||||
<em>{% trans 'Messages:' %}</em>
|
||||
<ul class="pf-c-list">
|
||||
{% for message in policy_result.messages %}
|
||||
|
@ -35,6 +36,7 @@
|
|||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if policy_result.source_results %}
|
||||
<em>{% trans 'Explanation:' %}</em>
|
||||
<ul class="pf-c-list">
|
||||
|
|
Reference in a new issue