Skip to content

Commit 29ba32c

Browse files
ROX-14473: require user org_id to match ACS owner org_id (#751)
Co-authored-by: dhaus67 <[email protected]>
1 parent 81ffd8b commit 29ba32c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

fleetshard/pkg/central/reconciler/init_auth.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ var (
6464
RoleName: "Admin",
6565
}
6666
},
67+
func(providerId string, auth private.ManagedCentralAllOfSpecAuth) *storage.Group {
68+
return &storage.Group{
69+
Props: &storage.GroupProperties{
70+
AuthProviderId: providerId,
71+
Key: "rh_is_org_admin",
72+
Value: "true",
73+
Traits: &storage.Traits{
74+
MutabilityMode: storage.Traits_ALLOW_MUTATE_FORCED,
75+
},
76+
},
77+
RoleName: "Admin",
78+
}
79+
},
6780
}
6881
)
6982

@@ -163,9 +176,17 @@ func createAuthProviderRequest(central private.ManagedCentral) *storage.AuthProv
163176
},
164177
ClaimMappings: map[string]string{
165178
"realm_access.roles": "groups",
179+
"org_id": "rh_org_id",
180+
"is_org_admin": "rh_is_org_admin",
166181
},
167182
// TODO: for testing purposes only; remove once host is correctly specified in fleet-manager
168183
ExtraUiEndpoints: []string{"localhost:8443"},
184+
RequiredAttributes: []*storage.AuthProvider_RequiredAttribute{
185+
{
186+
AttributeKey: "rh_org_id",
187+
AttributeValue: central.Spec.Auth.OwnerOrgId,
188+
},
189+
},
169190
Traits: &storage.Traits{
170191
MutabilityMode: storage.Traits_ALLOW_MUTATE_FORCED,
171192
},

0 commit comments

Comments
 (0)