fix: Cred rotation (#20)
* fix: Cred rotation - fix bug where the rotated service account key was not read. The response needs to be unmarshalled to pull out the values from th fields - fix bug where the time stamp was not getting updated after rotating credentials - fix bug where updates without setting a new secret fails
This commit is contained in:
1 parent
9acd3acf59
commit
baa2c7a2e7
6 files changed
+129
-33
No files matched your search
@@ -5,6 +5,7 @@ package credential
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
@@ -29,9 +30,17 @@ func NewTestIAMAdminServer(createServiceAccountKeyError error, deleteServiceAcco
|
||||
}
|
||||
|
||||
func (f *testIAMAdminServer) CreateServiceAccountKey(ctx context.Context, req *adminpb.CreateServiceAccountKeyRequest) (*adminpb.ServiceAccountKey, error) {
|
||||
serviceAccountKey := ServiceAccountPrivateKey{
|
||||
PrivateKey: "updated-private-key",
|
||||
PrivateKeyID: "updated-private-key-id",
|
||||
}
|
||||
serviceAccountKeyData, err := json.Marshal(serviceAccountKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal service account key: %v", err)
|
||||
}
|
||||
resp := &adminpb.ServiceAccountKey{
|
||||
Name: "projects/-/serviceAccounts/1234/keys/updated-private-key-id",
|
||||
PrivateKeyData: []byte("updated-private-key"),
|
||||
PrivateKeyData: serviceAccountKeyData,
|
||||
}
|
||||
return resp, f.testCreateServiceAccountKeyError
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user