providers/oidc(minor): correctly create audit entry on authz

This commit is contained in:
Langhammer, Jens 2019-10-08 14:34:59 +02:00
parent d91a852eda
commit b1e4e32b83
3 changed files with 9 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# Generated by Django 2.2.6 on 2019-10-08 12:23 # Generated by Django 2.2.6 on 2019-10-08 12:23
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -3,6 +3,7 @@ from django.contrib import messages
from django.shortcuts import redirect from django.shortcuts import redirect
from structlog import get_logger from structlog import get_logger
from passbook.audit.models import AuditEntry
from passbook.core.models import Application from passbook.core.models import Application
from passbook.policies.engine import PolicyEngine from passbook.policies.engine import PolicyEngine
@ -26,4 +27,10 @@ def check_permissions(request, user, client):
for policy_message in policy_messages: for policy_message in policy_messages:
messages.error(request, policy_message) messages.error(request, policy_message)
return redirect('passbook_providers_oauth:oauth2-permission-denied') 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 return None

View File

@ -38,7 +38,7 @@ class SAMLProvider(Provider):
if not self._processor: if not self._processor:
try: try:
self._processor = path_to_class(self.processor_path)(self) self._processor = path_to_class(self.processor_path)(self)
except ModuleNotFoundError as exc: except ImportError as exc:
LOGGER.warning(exc) LOGGER.warning(exc)
self._processor = None self._processor = None
return self._processor return self._processor