Skip to content

Commit

Permalink
responding to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay-gopalan committed Nov 14, 2023
1 parent 1a65c04 commit 161616d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func getTestBackendMocked(t *testing.T, initConfig bool) (*azureSecretBackend, l

b.settings = new(clientSettings)
mockProvider := newMockProvider()
//setupMockMSGraphClient(mockProvider)
b.getProvider = func(s *clientSettings, p api.Passwords) (AzureProvider, error) {
return mockProvider, nil
}
Expand Down
7 changes: 5 additions & 2 deletions path_rotate_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"fmt"
"time"

"github.com/google/uuid"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
)
Expand Down Expand Up @@ -73,7 +73,10 @@ func (b *azureSecretBackend) pathRotateRoot(ctx context.Context, req *logical.Re

app := apps[0]

uniqueID := uuid.New()
uniqueID, err := uuid.GenerateUUID()
if err != nil {
return nil, fmt.Errorf("failed to generate UUID: %w", err)
}

// This could have the same username customization logic put on it if we really wanted it here
passwordDisplayName := fmt.Sprintf("vault-%s", uniqueID)
Expand Down
11 changes: 2 additions & 9 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ var _ AzureProvider = (*provider)(nil)
// at this layer, the response signature may different from the Azure signature.
type provider struct {
settings *clientSettings
// HTTP Client used to make role assignment and definition requests
// using new arm libraries
httpClient *http.Client

appClient api.ApplicationsClient
spClient api.ServicePrincipalClient
Expand All @@ -61,9 +58,6 @@ type provider struct {

// newAzureProvider creates an azureProvider, backed by Azure client objects for underlying services.
func newAzureProvider(settings *clientSettings, passwords api.Passwords) (AzureProvider, error) {
// @TODO see if this is still needed
// build clients that use the GraphRBAC endpoint
//userAgent := useragent.PluginString(settings.PluginEnv, userAgentPluginName)
httpClient := cleanhttp.DefaultClient()

cred, err := getTokenCredential(settings)
Expand All @@ -89,8 +83,7 @@ func newAzureProvider(settings *clientSettings, passwords api.Passwords) (AzureP
}

p := &provider{
settings: settings,
httpClient: httpClient,
settings: settings,

appClient: msGraphAppClient,
spClient: msGraphAppClient,
Expand Down Expand Up @@ -218,7 +211,7 @@ func (p *provider) ListRoleDefinitions(ctx context.Context, scope string, filter
return listResp.Value, err
}

// GetRoleByID fetches the full role definition given a roleID.
// GetRoleDefinitionByID fetches the full role definition given a roleID.
func (p *provider) GetRoleDefinitionByID(ctx context.Context, roleID string) (result armauthorization.RoleDefinitionsClientGetByIDResponse, err error) {
return p.rdClient.GetByID(ctx, roleID, nil)
}
Expand Down

0 comments on commit 161616d

Please sign in to comment.