diff --git a/tap/identity-handlers/tyk_handler_test.go b/tap/identity-handlers/tyk_handler_test.go index 1555b342..e96255c0 100644 --- a/tap/identity-handlers/tyk_handler_test.go +++ b/tap/identity-handlers/tyk_handler_test.go @@ -14,6 +14,7 @@ const ( var UserGroupMapping = map[string]string{ "devs": "devs-group", "admins": "admins-group", + "CN=tyk_admin,OU=Security Groups,OU=GenericOrg,DC=GenericOrg,DC=COM,DC=GEN": "tyk-admin", } func TestGetEmail(t *testing.T) { @@ -204,6 +205,22 @@ func TestGetGroupId(t *testing.T) { DefaultGroupID: "devs", UserGroupMapping: UserGroupMapping, }, + { + TestName: "Custom group id field not empty, and the claim being an array", + CustomGroupIDField: "memberOf", + user: goth.User{RawData: map[string]interface{}{ + "memberOf": []string{ + "CN=tyk_admin,OU=Security Groups,OU=GenericOrg,DC=GenericOrg,DC=COM,DC=GEN", + "CN=openshift-uat-users,OU=Security Groups,OU=GenericOrg,DC=GenericOrg,DC=COM,DC=GEN", + "CN=Generic Contract Employees,OU=Email_Group,OU=GenericOrg,DC=GenericOrg,DC=COM,DC=GEN", + "CN=VPN-Group-Outsourced,OU=Security Groups,OU=GenericOrg,DC=GenericOrg,DC=COM,DC=GEN", + "CN=Normal Group,OU=Security Groups,OU=GenericOrg,DC=GenericOrg,DC=COM,DC=GEN", + }, + }}, + ExpectedGroupID: "tyk-admin", + DefaultGroupID: "devs", + UserGroupMapping: UserGroupMapping, + }, } for _, tc := range cases {