tba-concrete-claim-email 0.4.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-concrete-claim-email
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.10,<3.15
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Requires-Dist: tba-bases-claim (==0.4.0.dev2)
|
|
13
|
+
Requires-Dist: tba-primitives-identity (==0.4.0.dev2)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name="tba-concrete-claim-email"
|
|
3
|
+
version="0.4.0.dev2"
|
|
4
|
+
requires-python=">=3.10,<3.15"
|
|
5
|
+
dependencies=["tba-primitives-identity==0.4.0.dev2","tba-bases-claim==0.4.0.dev2"]
|
|
6
|
+
[build-system]
|
|
7
|
+
requires=["poetry-core>=1.0.0"]
|
|
8
|
+
build-backend="poetry.core.masonry.api"
|
|
9
|
+
[tool.poetry]
|
|
10
|
+
packages=[{include="tba_concrete_claim_email",from="src"}]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from datetime import date
|
|
2
|
+
from urllib.parse import urlsplit
|
|
3
|
+
|
|
4
|
+
from tba_bases_claim import ClaimBase
|
|
5
|
+
from tba_primitives_identity import ClaimType, ClaimValueType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _absolute_uri(value):
|
|
9
|
+
parsed = urlsplit(value) if isinstance(value, str) else None
|
|
10
|
+
return parsed is not None and bool(parsed.scheme and parsed.netloc)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _birthdate(value):
|
|
14
|
+
if not isinstance(value, str) or not value:
|
|
15
|
+
return False
|
|
16
|
+
try:
|
|
17
|
+
date.fromisoformat(value)
|
|
18
|
+
except ValueError:
|
|
19
|
+
return value.startswith("0000-") and len(value) == 10
|
|
20
|
+
return True
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class EmailClaim(ClaimBase):
|
|
24
|
+
claim_name = "email"
|
|
25
|
+
default_claim_type = ClaimType.IDENTITY
|
|
26
|
+
default_value_type = ClaimValueType.STRING
|
|
27
|
+
default_standards = ("OIDC Core 1.0",)
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def validate_value(cls, value):
|
|
31
|
+
if not (isinstance(value, str) and '@' in value and not value.startswith('@') and not value.endswith('@')):
|
|
32
|
+
raise ValueError("email has an invalid OIDC claim value")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
__all__ = ["EmailClaim"]
|
|
File without changes
|