1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-05-27 01:18:48 +02:00
This commit is contained in:
Kristoffer Dalby 2025-04-11 08:06:30 -04:00 committed by GitHub
commit 72877e4854
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -202,6 +202,37 @@ func TestOIDCClaimsJSONToUser(t *testing.T) {
},
},
},
{
// From https://github.com/juanfont/headscale/issues/2333
name: "casby-oidc-claim-20250513",
jsonstr: `
{
"sub": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"iss": "https://oidc.example.com/",
"aud": "xxxxxxxxxxxx",
"preferred_username": "user001",
"name": "User001",
"email": "user001@example.com",
"email_verified": true,
"picture": "https://cdn.casbin.org/img/casbin.svg",
"groups": [
"org1/department1",
"org1/department2"
]
}
`,
want: User{
Provider: util.RegisterMethodOIDC,
Name: "user001",
DisplayName: "User001",
Email: "user001@example.com",
ProviderIdentifier: sql.NullString{
String: "https://oidc.example.com//xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
Valid: true,
},
ProfilePicURL: "https://cdn.casbin.org/img/casbin.svg",
},
},
}
for _, tt := range tests {