Skip to content

Commit 335b105

Browse files
committed
[identity] use id_token sub claim as machine accounts username
1 parent 9b87efb commit 335b105

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • apps/boruta_identity/lib/boruta_identity/accounts/backends

apps/boruta_identity/lib/boruta_identity/accounts/backends/machine.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ defmodule BorutaIdentity.Accounts.Machine do
4545
end
4646

4747
defp upsert_user(sub, claims, %Backend{id: backend_id}) do
48+
username = claims["sub"]
4849
attrs = %{
4950
uid: sub,
50-
username: sub,
51+
username: username,
5152
account_type: @account_type,
5253
backend_id: backend_id
5354
}
@@ -66,7 +67,7 @@ defmodule BorutaIdentity.Accounts.Machine do
6667
from(u in User,
6768
update: [
6869
set: [
69-
username: ^sub,
70+
username: ^username,
7071
]
7172
]
7273
),

0 commit comments

Comments
 (0)