From 7045a630996e08c18beb7c3d39e1b2752c8a4ba4 Mon Sep 17 00:00:00 2001 From: Aria Date: Sun, 1 Oct 2023 22:55:08 +0100 Subject: a working version with only changing passwords --- path_static_roles.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'path_static_roles.go') diff --git a/path_static_roles.go b/path_static_roles.go index a9b3ee9..c4bf094 100644 --- a/path_static_roles.go +++ b/path_static_roles.go @@ -108,12 +108,13 @@ func (b *krbBackend) pathRolesRead(ctx context.Context, req *logical.Request, d // pathRolesWrite makes a request to Vault storage to update a role based on the attributes passed to the role configuration func (b *krbBackend) pathRolesWrite(ctx context.Context, req *logical.Request, d *framework.FieldData) (*logical.Response, error) { - name, ok := d.GetOk("name") + rawName, ok := d.GetOk("name") if !ok { return logical.ErrorResponse("missing role name"), nil } + name := rawName.(string) - roleEntry, err := b.getRole(ctx, req.Storage, name.(string)) + roleEntry, err := b.getRole(ctx, req.Storage, name) if err != nil { return nil, err } @@ -132,10 +133,12 @@ func (b *krbBackend) pathRolesWrite(ctx context.Context, req *logical.Request, d roleEntry.LastVaultRotation = time.Unix(0, 0) - if err := setRole(ctx, req.Storage, name.(string), roleEntry); err != nil { + if err := setRole(ctx, req.Storage, name, roleEntry); err != nil { return nil, err } + b.backgroundRotation(name, req.Storage) + return nil, nil } -- cgit v1.2.3