From fe6673c0192746e00f3591e3ac25d85f4f63b764 Mon Sep 17 00:00:00 2001 From: Andy Lo-A-Foe Date: Tue, 13 Feb 2024 07:38:27 +0100 Subject: [PATCH] Remove tenant experiment - tenancy must be tied to a client ID --- connector/hsdp/extend_payload.go | 21 --------------------- connector/hsdp/hsdp_test.go | 13 ++++++------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/connector/hsdp/extend_payload.go b/connector/hsdp/extend_payload.go index ca9adeaccb..3d99c3cef6 100644 --- a/connector/hsdp/extend_payload.go +++ b/connector/hsdp/extend_payload.go @@ -4,8 +4,6 @@ import ( "encoding/json" "fmt" "strings" - - "golang.org/x/exp/slices" ) func (c *HSDPConnector) ExtendPayload(scopes []string, payload []byte, cdata []byte) ([]byte, error) { @@ -32,25 +30,6 @@ func (c *HSDPConnector) ExtendPayload(scopes []string, payload []byte, cdata []b if scope == "hsp:iam:token" { originalClaims["tkn"] = string(cd.AccessToken) } - - // Experimental tenant scoping - if strings.HasPrefix(scope, "tenant:") { - group := strings.TrimPrefix(scope, "tenant:") - if slices.Contains(c.tenantGroups, group) { - var tenants []string - // Iterate through introspect and add OrgID as tenant when matched - for _, org := range cd.Introspect.Organizations.OrganizationList { - for _, orgGroup := range org.Groups { - if group == orgGroup { - tenants = append(tenants, org.OrganizationID) - } - } - } - if len(tenants) > 0 { - originalClaims[scope] = tenants - } - } - } } originalClaims["mid"] = cd.Introspect.Organizations.ManagingOrganization originalClaims["tid"] = trustedOrgID diff --git a/connector/hsdp/hsdp_test.go b/connector/hsdp/hsdp_test.go index 6629a53358..9245b84415 100644 --- a/connector/hsdp/hsdp_test.go +++ b/connector/hsdp/hsdp_test.go @@ -40,13 +40,12 @@ func TestHandleCallback(t *testing.T) { expectUserID: "subvalue", expectUserName: "username", token: map[string]interface{}{ - "sub": "subvalue", - "name": "namevalue", - "username": "username", - "email": "emailvalue", - "given_name": "givenname", - "family_name": "familyname", - "tenant:logreaders": []string{"foo", "bar"}, + "sub": "subvalue", + "name": "namevalue", + "username": "username", + "email": "emailvalue", + "given_name": "givenname", + "family_name": "familyname", }, }, }