From b1e4e32b837d68584ef2eab6c7d28ccaf69db7f5 Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Tue, 8 Oct 2019 14:34:59 +0200 Subject: [PATCH] providers/oidc(minor): correctly create audit entry on authz --- passbook/factors/email/migrations/0001_initial.py | 2 +- passbook/providers/oidc/lib.py | 7 +++++++ passbook/providers/saml/models.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/passbook/factors/email/migrations/0001_initial.py b/passbook/factors/email/migrations/0001_initial.py index 5514a4f7c..68d5a99cd 100644 --- a/passbook/factors/email/migrations/0001_initial.py +++ b/passbook/factors/email/migrations/0001_initial.py @@ -1,7 +1,7 @@ # Generated by Django 2.2.6 on 2019-10-08 12:23 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/passbook/providers/oidc/lib.py b/passbook/providers/oidc/lib.py index ce82d100f..057be13b5 100644 --- a/passbook/providers/oidc/lib.py +++ b/passbook/providers/oidc/lib.py @@ -3,6 +3,7 @@ from django.contrib import messages from django.shortcuts import redirect from structlog import get_logger +from passbook.audit.models import AuditEntry from passbook.core.models import Application from passbook.policies.engine import PolicyEngine @@ -26,4 +27,10 @@ def check_permissions(request, user, client): for policy_message in policy_messages: messages.error(request, policy_message) return redirect('passbook_providers_oauth:oauth2-permission-denied') + + AuditEntry.create( + action=AuditEntry.ACTION_AUTHORIZE_APPLICATION, + request=request, + app=application.name, + skipped_authorization=False) return None diff --git a/passbook/providers/saml/models.py b/passbook/providers/saml/models.py index 0ff80982a..3c1ec2f5e 100644 --- a/passbook/providers/saml/models.py +++ b/passbook/providers/saml/models.py @@ -38,7 +38,7 @@ class SAMLProvider(Provider): if not self._processor: try: self._processor = path_to_class(self.processor_path)(self) - except ModuleNotFoundError as exc: + except ImportError as exc: LOGGER.warning(exc) self._processor = None return self._processor