Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sp/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class IdPAdmin(admin.ModelAdmin):
"fields": (
"contact_name",
"contact_email",
"authn_requests_signed",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be down in the "Advanced" group below.

"x509_certificate",
"private_key",
"certificate_expires",
Expand Down
18 changes: 18 additions & 0 deletions sp/migrations/0016_idp_authn_requests_signed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2 on 2024-05-24 17:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('sp', '0015_idp_logout_request_signed_idp_logout_response_signed'),
]

operations = [
migrations.AddField(
model_name='idp',
name='authn_requests_signed',
field=models.BooleanField(default=False, verbose_name='Sign Authentication Request'),
),
]
6 changes: 6 additions & 0 deletions sp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class IdP(models.Model):
)
contact_name = models.CharField(max_length=100)
contact_email = models.EmailField(max_length=100)

authn_requests_signed = models.BooleanField(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor quibble, but can you put this down by the logout_request_signed and logout_response_signed fields?

_("Sign Authentication Request"), default=False
)

x509_certificate = models.TextField(blank=True)
private_key = models.TextField(blank=True)
certificate_expires = models.DateTimeField(null=True, blank=True)
Expand Down Expand Up @@ -217,6 +222,7 @@ def sp_settings(self):
"security": {
"wantAttributeStatement": self.require_attributes,
"metadataValidUntil": self.certificate_expires,
"authnRequestsSigned": self.authn_requests_signed,
"requestedAuthnContextComparison": self.authn_comparison,
"requestedAuthnContext": self.authn_context,
"logoutRequestSigned": self.logout_request_signed,
Expand Down
2 changes: 2 additions & 0 deletions sp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

def metadata(request, **kwargs):
idp = get_request_idp(request, **kwargs)
print(idp.sp_settings)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this


saml_settings = OneLogin_Saml2_Settings(
settings=idp.sp_settings, sp_validation_only=True
)
Expand Down