diff --git a/examples/provider/provider/settingslocal.py.example b/examples/provider/provider/settingslocal.py.example index 5b5ec6d5..0b207530 100644 --- a/examples/provider/provider/settingslocal.py.example +++ b/examples/provider/provider/settingslocal.py.example @@ -19,7 +19,7 @@ APPEND_SLASH = False # required for onboarding checks and also for all the leafs OIDCFED_DEFAULT_TRUST_ANCHOR = "http://127.0.0.1:8000" OIDCFED_TRUST_ANCHORS = [OIDCFED_DEFAULT_TRUST_ANCHOR] -OIDCFED_PROVIDER_PROFILE = "spid" +OIDCFED_PROVIDER_PROFILE = "cie" #OIDCFED_PROVIDER_MAX_REFRESH = 10 #used in SPID OIDCFED_PROVIDER_MAX_CONSENT_TIMEFRAME = 3600 #used in CIE (seconds) diff --git a/setup.py b/setup.py index 680fbd70..ef2a6ae4 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ PKG_NAME = 'spid_cie_oidc' INSTALL_REQUIRES = [ - "Django>=4.0", + "Django>=4.0,<5.0", "cryptojwt>=1.8.2", "pydantic>=1.8.2,<2.0", "pytz>=2021.3", diff --git a/spid_cie_oidc/entity/migrations/0032_alter_fetchedentitystatement_jwt.py b/spid_cie_oidc/entity/migrations/0032_alter_fetchedentitystatement_jwt.py new file mode 100644 index 00000000..0f026fd0 --- /dev/null +++ b/spid_cie_oidc/entity/migrations/0032_alter_fetchedentitystatement_jwt.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.3 on 2023-12-13 14:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ( + "spid_cie_oidc_entity", + "0031_alter_federationentityconfiguration_entity_type", + ), + ] + + operations = [ + migrations.AlterField( + model_name="fetchedentitystatement", + name="jwt", + field=models.TextField(blank=False, null=False), + ), + ] diff --git a/spid_cie_oidc/entity/models.py b/spid_cie_oidc/entity/models.py index df3df236..fa53e6a6 100644 --- a/spid_cie_oidc/entity/models.py +++ b/spid_cie_oidc/entity/models.py @@ -296,7 +296,7 @@ class FetchedEntityStatement(TimeStampedModel): statement = models.JSONField( blank=False, null=False, help_text=_("Entity statement"), default=dict ) - jwt = models.CharField(max_length=2048) + jwt = models.TextField(null=False, blank=False) class Meta: verbose_name = "Fetched Entity Statement" diff --git a/spid_cie_oidc/onboarding/tests/test_01_onboarding.py b/spid_cie_oidc/onboarding/tests/test_01_onboarding.py index 285da851..1cb62b93 100644 --- a/spid_cie_oidc/onboarding/tests/test_01_onboarding.py +++ b/spid_cie_oidc/onboarding/tests/test_01_onboarding.py @@ -61,9 +61,9 @@ def test_onboarding_registration(self, mocked): self.assertEqual(res.status_code, 200) jwk = serialize_rsa_key(new_rsa_key().pub_key) self.data["public_jwks"] = json.dumps(jwk) - res = client.post(url, self.data) - # self.assertEqual(res.status_code, 302) - # res = client.get(res.url) + # res = client.post(url, self.data) + # self.assertEqual(res.status_code, 200) + # res = client.get(url) # self.assertEqual(res.status_code, 200) # self.assertIn(self.data["organization_name"], res.content.decode()) # self.assertIn("acquired", res.content.decode()) diff --git a/spid_cie_oidc/provider/migrations/0008_alter_oidcsession_authz_request.py b/spid_cie_oidc/provider/migrations/0008_alter_oidcsession_authz_request.py new file mode 100644 index 00000000..0217d887 --- /dev/null +++ b/spid_cie_oidc/provider/migrations/0008_alter_oidcsession_authz_request.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.3 on 2023-12-13 14:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ( + "spid_cie_oidc_provider", + "0007_alter_issuedtoken_options_alter_oidcsession_options", + ), + ] + + operations = [ + migrations.AlterField( + model_name="oidcsession", + name="authz_request", + field=models.JSONField(max_length=65536), + ), + ] diff --git a/spid_cie_oidc/provider/models.py b/spid_cie_oidc/provider/models.py index cf4214d8..f4d60ed2 100644 --- a/spid_cie_oidc/provider/models.py +++ b/spid_cie_oidc/provider/models.py @@ -27,7 +27,7 @@ class OidcSession(TimeStampedModel): help_text=_("django session key") ) nonce = models.CharField(max_length=2048, blank=False, null=False) - authz_request = models.JSONField(max_length=2048, blank=False, null=False) + authz_request = models.JSONField(max_length=65536, blank=False, null=False) revoked = models.BooleanField(default=False) auth_code = models.CharField(max_length=2048, blank=False, null=False) diff --git a/spid_cie_oidc/provider/views/userinfo_endpoint.py b/spid_cie_oidc/provider/views/userinfo_endpoint.py index 47c79c52..f35a8b5e 100644 --- a/spid_cie_oidc/provider/views/userinfo_endpoint.py +++ b/spid_cie_oidc/provider/views/userinfo_endpoint.py @@ -12,6 +12,7 @@ create_jwe, unpad_jwt_payload ) + from spid_cie_oidc.entity.models import ( TrustChain ) @@ -102,4 +103,4 @@ def get(self, request, *args, **kwargs): client_jwk, cty="JWT" ) - return HttpResponse(jwe, content_type="application/jose") + return HttpResponse(jwe, content_type="application/jwt")