mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
Add tests to ensure that OIDC user can create IAM users (#13881)
This commit is contained in:
committed by
GitHub
parent
c76f86fdbd
commit
a02e17f15c
@@ -831,6 +831,28 @@ func (s *TestSuiteIAM) TestServiceAccountOpsByAdmin(c *check) {
|
||||
c.assertSvcAccDeletion(ctx, s, s.adm, accessKey, bucket)
|
||||
}
|
||||
|
||||
func (c *check) mustCreateIAMUser(ctx context.Context, admClnt *madmin.AdminClient) madmin.Credentials {
|
||||
randUser := mustGetUUID()
|
||||
randPass := mustGetUUID()
|
||||
err := admClnt.AddUser(ctx, randUser, randPass)
|
||||
if err != nil {
|
||||
c.Fatalf("should be able to create a user: %v", err)
|
||||
}
|
||||
return madmin.Credentials{
|
||||
AccessKey: randUser,
|
||||
SecretKey: randPass,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *check) mustNotCreateIAMUser(ctx context.Context, admClnt *madmin.AdminClient) {
|
||||
randUser := mustGetUUID()
|
||||
randPass := mustGetUUID()
|
||||
err := admClnt.AddUser(ctx, randUser, randPass)
|
||||
if err == nil {
|
||||
c.Fatalf("should not be able to create a user")
|
||||
}
|
||||
}
|
||||
|
||||
func (c *check) mustCreateSvcAccount(ctx context.Context, tgtUser string, admClnt *madmin.AdminClient) madmin.Credentials {
|
||||
cr, err := admClnt.AddServiceAccount(ctx, madmin.AddServiceAccountReq{
|
||||
TargetUser: tgtUser,
|
||||
|
||||
Reference in New Issue
Block a user