Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: EligibilityVerifier custom text #331

Merged
merged 8 commits into from
Mar 22, 2022
20 changes: 18 additions & 2 deletions benefits/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,30 @@ class Migration(migrations.Migration):
("api_auth_header", models.TextField()),
("api_auth_key", models.TextField()),
# fmt: off
("sub_regex", models.TextField(help_text="A regular expression used to validate the 'sub' API field before sending to this verifier", null=True)), # noqa: E501
("name_max_length", models.PositiveSmallIntegerField(help_text="The maximum length accepted for the 'name' API field before sending to this verifier", null=True)), # noqa: E501
("form_sub_pattern", models.TextField(help_text="A regular expression used to validate the 'sub' API field before sending to this verifier", null=True)), # noqa: E501
("form_name_max_length", models.PositiveSmallIntegerField(help_text="The maximum length accepted for the 'name' API field before sending to this verifier", null=True)), # noqa: E501
("public_key", models.ForeignKey(help_text="The Verifier's public key, used to encrypt requests targeted at this Verifier and to verify signed responses from this verifier.", on_delete=models.deletion.PROTECT, related_name="+", to="core.PemData")), # noqa: E501
("jwe_cek_enc", models.TextField(help_text="The JWE-compatible Content Encryption Key (CEK) key-length and mode")), # noqa: E501
("jwe_encryption_alg", models.TextField(help_text="The JWE-compatible encryption algorithm")),
# fmt: on
("jws_signing_alg", models.TextField(help_text="The JWS-compatible signing algorithm")),
("eligibility_types", models.ManyToManyField(to="core.EligibilityType")),
("selection_label", models.TextField()),
("selection_label_description", models.TextField(null=True)),
("instructions_content_title", models.TextField()),
("instructions_item_name", models.TextField()),
("instructions_item_description", models.TextField()),
("instructions_blurb", models.TextField()),
("form_title", models.TextField()),
("form_content_title", models.TextField()),
("form_blurb", models.TextField()),
("form_sub_label", models.TextField()),
("form_sub_placeholder", models.TextField()),
("form_name_label", models.TextField()),
("form_name_placeholder", models.TextField()),
("unverified_title", models.TextField()),
("unverified_content_title", models.TextField()),
("unverified_blurb", models.TextField()),
],
),
migrations.CreateModel(
Expand Down
20 changes: 18 additions & 2 deletions benefits/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,24 @@ class EligibilityVerifier(models.Model):
jwe_cek_enc = models.TextField(help_text="The JWE-compatible Content Encryption Key (CEK) key-length and mode")
jwe_encryption_alg = models.TextField(help_text="The JWE-compatible encryption algorithm")
jws_signing_alg = models.TextField(help_text="The JWS-compatible signing algorithm")
sub_regex = models.TextField(null=True, help_text="A regular expression used to validate the 'sub' API field before sending to this verifier") # noqa: 503
name_max_length = models.PositiveSmallIntegerField(null=True, help_text="The maximum length accepted for the 'name' API field before sending to this verifier") # noqa: 503
selection_label = models.TextField()
selection_label_description = models.TextField(null=True)
instructions_content_title = models.TextField()
instructions_item_name = models.TextField()
instructions_item_description = models.TextField()
instructions_blurb = models.TextField()
form_title = models.TextField()
form_content_title = models.TextField()
form_blurb = models.TextField()
form_sub_label = models.TextField()
form_sub_placeholder = models.TextField()
form_sub_pattern = models.TextField(null=True, help_text="A regular expression used to validate the 'sub' API field before sending to this verifier") # noqa: 503
form_name_label = models.TextField()
form_name_placeholder = models.TextField()
form_name_max_length = models.PositiveSmallIntegerField(null=True, help_text="The maximum length accepted for the 'name' API field before sending to this verifier") # noqa: 503
unverified_title = models.TextField()
unverified_content_title = models.TextField()
unverified_blurb = models.TextField()
# fmt: on

def __str__(self):
Expand Down
25 changes: 19 additions & 6 deletions fixtures/02_eligibilityverifier.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@
"api_url": "http://server:5000/verify",
"api_auth_header": "X-Server-API-Key",
"api_auth_key": "server-auth-token",
"eligibility_types": [
1,
2
],
"eligibility_types": [1, 2],
"public_key": 1,
"jwe_cek_enc": "A256CBC-HS512",
"jwe_encryption_alg": "RSA-OAEP",
"jws_signing_alg": "RS256",
"sub_regex": ".+",
"name_max_length": 255
"selection_label": "",
"selection_label_description": null,
"instructions_content_title": "eligibility.pages.index.content_title",
"instructions_item_name": "eligibility.pages.index.items[0].title",
"instructions_item_description": "eligibility.pages.index.items[0].text",
"instructions_blurb": "eligibility.pages.index.p[0]",
"form_title": "eligibility.pages.confirm.title",
"form_content_title": "eligibility.pages.confirm.content_title",
"form_blurb": "eligibility.pages.confirm.p[0]",
"form_sub_label": "eligibility.forms.confirm.fields.sub",
"form_sub_placeholder": "",
"form_sub_pattern": ".+",
"form_name_label": "eligibility.forms.confirm.fields.name",
"form_name_placeholder": "",
"form_name_max_length": 255,
"unverified_title": "eligibility.pages.unverified.title",
"unverified_content_title": "eligibility.pages.unverified.content_title",
"unverified_blurb": "eligibility.pages.unverified.p[0]"
}
}
]