Skip to content

Commit 7e2a207

Browse files
authored
Add verification enabled flag (#438)
This PR - bumps the `kratos-info` lib version - adds `verification_enabled` flag to the workload
2 parents 7e9526c + ecdefb0 commit 7e2a207

5 files changed

Lines changed: 12 additions & 1 deletion

File tree

lib/charms/kratos/v0/kratos_info.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def some_event_function():
5454

5555
# Increment this PATCH version before using `charmcraft publish-lib` or reset
5656
# to 0 if you are raising the major API version
57-
LIBPATCH = 4
57+
LIBPATCH = 6
5858

5959
RELATION_NAME = "kratos-info"
6060
INTERFACE_NAME = "kratos_info"
@@ -98,6 +98,8 @@ def send_info_relation_data(
9898
configmaps_namespace: str,
9999
mfa_enabled: bool,
100100
oidc_webauthn_sequencing_enabled: bool,
101+
verification_enabled: bool,
102+
feature_flags: Optional[list[str]] = None,
101103
) -> None:
102104
"""Updates relation with endpoints, config and configmaps info."""
103105
if not self._charm.unit.is_leader():
@@ -116,8 +118,12 @@ def send_info_relation_data(
116118
"configmaps_namespace": configmaps_namespace,
117119
"mfa_enabled": str(mfa_enabled),
118120
"oidc_webauthn_sequencing_enabled": str(oidc_webauthn_sequencing_enabled),
121+
"verification_enabled": str(verification_enabled),
119122
}
120123

124+
if feature_flags:
125+
info_databag["feature_flags"] = ",".join(feature_flags)
126+
121127
for relation in relations:
122128
relation.data[self._charm.app].update(info_databag)
123129

src/integrations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class KratosInfoData:
5454
admin_endpoint: str = ""
5555
mfa_enabled: bool = False
5656
oidc_webauthn_sequencing_enabled: bool = False
57+
verification_enabled: bool = False
5758
is_ready: bool = False
5859
feature_flags: Optional[list[str]] = None
5960

@@ -73,6 +74,7 @@ def load(cls, requirer: KratosInfoRequirer) -> "KratosInfoData":
7374
admin_endpoint=info.get("admin_endpoint"),
7475
mfa_enabled=info.get("mfa_enabled"),
7576
oidc_webauthn_sequencing_enabled=info.get("oidc_webauthn_sequencing_enabled"),
77+
verification_enabled=info.get("verification_enabled"),
7678
is_ready=requirer.is_ready(),
7779
feature_flags=info.get("feature_flags", None),
7880
)

src/services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def render_pebble_layer(
103103
container["environment"]["OIDC_WEBAUTHN_SEQUENCING_ENABLED"] = (
104104
kratos_info.oidc_webauthn_sequencing_enabled
105105
)
106+
container["environment"]["VERIFICATION_ENABLED"] = kratos_info.verification_enabled
106107

107108
if tracing_data.is_ready:
108109
container["environment"]["OTEL_HTTP_ENDPOINT"] = tracing_data.http_endpoint

tests/unit/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def kratos_relation() -> ops.testing.Relation:
121121
"public_endpoint": "http://kratos-public-url:80/testing-kratos",
122122
"mfa_enabled": "True",
123123
"oidc_webauthn_sequencing_enabled": "False",
124+
"verification_enabled": "True",
124125
"feature_flags": "password,totp,webauthn,backup_codes,account_linking",
125126
},
126127
)

tests/unit/test_charm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def test_layer_env_updated_with_kratos_info(
125125
assert env["KRATOS_PUBLIC_URL"] == kratos_data["public_endpoint"]
126126
assert env["KRATOS_ADMIN_URL"] == kratos_data["admin_endpoint"]
127127
assert str(env["MFA_ENABLED"]) == kratos_data["mfa_enabled"]
128+
assert str(env["VERIFICATION_ENABLED"]) == kratos_data["verification_enabled"]
128129
assert (
129130
str(env["OIDC_WEBAUTHN_SEQUENCING_ENABLED"])
130131
== kratos_data["oidc_webauthn_sequencing_enabled"]

0 commit comments

Comments
 (0)