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: add LoginMethodNode.credentialId field #538

Merged
merged 1 commit into from
Jan 17, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
method: LoginMethodType!
createdAt: DateTime
userLabel: String
credentialId: String
}

type SensitiveDataNode implements Node {
Expand Down
1 change: 1 addition & 0 deletions profiles/keycloak_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def get_user_credential_types(user_id) -> list[dict]:
else None
)
credential = {
"credential_id": c["id"],
"method": c["type"],
"created_at": created_at,
"user_label": c.get("userLabel"),
Expand Down
3 changes: 3 additions & 0 deletions profiles/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ class LoginMethodNode(graphene.ObjectType):
user_label = graphene.String(
description="User-friendly label for the login method."
)
credential_id = graphene.String(
description="Identifier for a credential type login method."
)


class VerifiedPersonalInformationAddressNode(graphene.ObjectType):
Expand Down
4 changes: 4 additions & 0 deletions profiles/tests/test_gql_my_profile_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ def test_user_can_see_own_login_methods_with_correct_amr_claim(
),
"method": "password",
"user_label": None,
"credential_id": "93793c36-dd30-44c7-96b9-920c3b921f7c",
},
],
)
Expand All @@ -650,6 +651,7 @@ def test_user_can_see_own_login_methods_with_correct_amr_claim(
method
createdAt
userLabel
credentialId
}
}
}
Expand All @@ -667,11 +669,13 @@ def test_user_can_see_own_login_methods_with_correct_amr_claim(
"createdAt": None,
"method": "SUOMI_FI",
"userLabel": None,
"credentialId": None,
},
{
"createdAt": "2024-12-05T11:54:21.491000+00:00",
"method": "PASSWORD",
"userLabel": None,
"credentialId": "93793c36-dd30-44c7-96b9-920c3b921f7c",
},
]

Expand Down
3 changes: 3 additions & 0 deletions profiles/tests/test_keycloak_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def test_get_user_credential_types_no_client(monkeypatch):
[PASSWORD_METHOD],
[
{
"credential_id": PASSWORD_METHOD["id"],
"created_at": datetime.datetime(
2024, 12, 5, 11, 54, 21, 491000, tzinfo=datetime.UTC
),
Expand All @@ -129,13 +130,15 @@ def test_get_user_credential_types_no_client(monkeypatch):
[PASSWORD_METHOD, OTP_METHOD],
[
{
"credential_id": PASSWORD_METHOD["id"],
"created_at": datetime.datetime(
2024, 12, 5, 11, 54, 21, 491000, tzinfo=datetime.UTC
),
"method": "password",
"user_label": None,
},
{
"credential_id": OTP_METHOD["id"],
"created_at": datetime.datetime(
2024, 5, 28, 10, 14, 12, 633000, tzinfo=datetime.UTC
),
Expand Down
Loading