mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-08 19:27:41 +00:00
fix missing preferred login name
This commit is contained in:
parent
953e9433eb
commit
657c2a5408
@ -48,7 +48,7 @@ func TestOPStorage_SetUserinfoFromToken(t *testing.T) {
|
||||
assertUserinfo(t, userinfo)
|
||||
}
|
||||
|
||||
func TestOPStorage_SetIntrospectionFromToken(t *testing.T) {
|
||||
func TestServer_Introspect(t *testing.T) {
|
||||
project, err := Tester.CreateProject(CTX)
|
||||
require.NoError(t, err)
|
||||
app, err := Tester.CreateOIDCNativeClient(CTX, redirectURI, logoutRedirectURI, project.GetId())
|
||||
|
@ -2,10 +2,12 @@
|
||||
-- prepare q (text, text, text[]) as
|
||||
|
||||
with usr as (
|
||||
select id, creation_date, change_date, sequence, state, resource_owner, username
|
||||
select u.id, u.creation_date, u.change_date, u.sequence, u.state, u.resource_owner, u.username, n.login_name as preferred_login_name
|
||||
from projections.users9 u
|
||||
where id = $1
|
||||
and instance_id = $2
|
||||
left join projections.login_names2 n on u.id = n.user_id and u.instance_id = n.instance_id
|
||||
where u.id = $1
|
||||
and u.instance_id = $2
|
||||
and n.is_primary = true
|
||||
),
|
||||
human as (
|
||||
select $1 as user_id, row_to_json(r) as human from (
|
||||
@ -69,6 +71,7 @@ grants as (
|
||||
left join orgs o on o.id = g.resource_owner
|
||||
left join projections.projects3 p on p.id = g.project_id
|
||||
left join usr u on u.id = g.user_id
|
||||
where p.instance_id = $2
|
||||
) r
|
||||
)
|
||||
-- build the final result JSON
|
||||
|
3
internal/query/testdata/userinfo_human.json
vendored
3
internal/query/testdata/userinfo_human.json
vendored
@ -7,6 +7,7 @@
|
||||
"state": 1,
|
||||
"resource_owner": "231848297847848962",
|
||||
"username": "tim+tesmail@zitadel.com",
|
||||
"preferred_login_name": "tim+tesmail@zitadel.com@demo.localhost",
|
||||
"human": {
|
||||
"first_name": "Tim",
|
||||
"last_name": "Mohlmann",
|
||||
@ -43,4 +44,4 @@
|
||||
}
|
||||
],
|
||||
"user_grants": null
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
"state": 1,
|
||||
"resource_owner": "231848297847848962",
|
||||
"username": "tim+tesmail@zitadel.com",
|
||||
"preferred_login_name": "tim+tesmail@zitadel.com@demo.localhost",
|
||||
"human": {
|
||||
"first_name": "Tim",
|
||||
"last_name": "Mohlmann",
|
||||
@ -82,5 +83,4 @@
|
||||
"user_resource_owner": "231848297847848962"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
"state": 1,
|
||||
"resource_owner": "231848297847848962",
|
||||
"username": "tim+tesmail@zitadel.com",
|
||||
"preferred_login_name": "tim+tesmail@zitadel.com@demo.localhost",
|
||||
"human": {
|
||||
"first_name": "Tim",
|
||||
"last_name": "Mohlmann",
|
||||
@ -26,4 +27,4 @@
|
||||
},
|
||||
"metadata": null,
|
||||
"user_grants": null
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
"state": 1,
|
||||
"resource_owner": "231848297847848962",
|
||||
"username": "tests",
|
||||
"preferred_login_name": "tests@demo.localhost",
|
||||
"human": null,
|
||||
"machine": {
|
||||
"name": "tests",
|
||||
|
@ -80,6 +80,7 @@ func TestQueries_GetOIDCUserInfo(t *testing.T) {
|
||||
State: 1,
|
||||
ResourceOwner: "231848297847848962",
|
||||
Username: "tim+tesmail@zitadel.com",
|
||||
PreferredLoginName: "tim+tesmail@zitadel.com@demo.localhost",
|
||||
Human: &Human{
|
||||
FirstName: "Tim",
|
||||
LastName: "Mohlmann",
|
||||
@ -115,6 +116,7 @@ func TestQueries_GetOIDCUserInfo(t *testing.T) {
|
||||
State: 1,
|
||||
ResourceOwner: "231848297847848962",
|
||||
Username: "tim+tesmail@zitadel.com",
|
||||
PreferredLoginName: "tim+tesmail@zitadel.com@demo.localhost",
|
||||
Human: &Human{
|
||||
FirstName: "Tim",
|
||||
LastName: "Mohlmann",
|
||||
@ -172,6 +174,7 @@ func TestQueries_GetOIDCUserInfo(t *testing.T) {
|
||||
State: 1,
|
||||
ResourceOwner: "231848297847848962",
|
||||
Username: "tim+tesmail@zitadel.com",
|
||||
PreferredLoginName: "tim+tesmail@zitadel.com@demo.localhost",
|
||||
Human: &Human{
|
||||
FirstName: "Tim",
|
||||
LastName: "Mohlmann",
|
||||
@ -264,6 +267,7 @@ func TestQueries_GetOIDCUserInfo(t *testing.T) {
|
||||
State: 1,
|
||||
ResourceOwner: "231848297847848962",
|
||||
Username: "tests",
|
||||
PreferredLoginName: "tests@demo.localhost",
|
||||
Human: nil,
|
||||
Machine: &Machine{
|
||||
Name: "tests",
|
||||
|
Loading…
x
Reference in New Issue
Block a user