1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-05-27 01:18:48 +02:00

add casbin user test

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2025-03-13 09:38:14 +01:00
parent fe06a00d45
commit 21ac0388da
No known key found for this signature in database

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 {