-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: updates to password policy generator (#11596)
* core: fix bug in password policies not using namespaces * Add changelog
- Loading branch information
1 parent
b26a365
commit afc0b8e
Showing
4 changed files
with
89 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
core (enterprise): Fix plugins mounted in namespaces being unable to use password policies | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// +build !enterprise | ||
|
||
package vault | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
) | ||
|
||
const ( | ||
passwordPolicySubPath = "password_policy/" | ||
) | ||
|
||
// retrievePasswordPolicy retrieves a password policy from the logical storage | ||
func (d dynamicSystemView) retrievePasswordPolicy(ctx context.Context, policyName string) (*passwordPolicyConfig, error) { | ||
storage := d.core.systemBarrierView.SubView(passwordPolicySubPath) | ||
entry, err := storage.Get(ctx, policyName) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if entry == nil { | ||
return nil, nil | ||
} | ||
|
||
policyCfg := &passwordPolicyConfig{} | ||
err = json.Unmarshal(entry.Value, &policyCfg) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to unmarshal stored data: %w", err) | ||
} | ||
|
||
return policyCfg, nil | ||
} |