mongodb secret backend: Prefix all generated usernames with "vault-", and cleanly handle empty display names when generating usernames

This commit is contained in:
Matt Hurne
2016-06-30 21:11:45 -04:00
parent b9d681cb9d
commit 3c666532c8
2 changed files with 10 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/hashicorp/vault/logical"
logicaltest "github.com/hashicorp/vault/logical/testing"
"github.com/mitchellh/mapstructure"
"strings"
)
func TestBackend_basic(t *testing.T) {
@@ -113,6 +114,9 @@ func testAccStepReadCreds(t *testing.T, name string) logicaltest.TestStep {
if d.Username == "" {
return fmt.Errorf("bad: %#v", resp)
}
if !strings.HasPrefix(d.Username, "vault-root-") {
return fmt.Errorf("bad: %#v", resp)
}
if d.Password == "" {
return fmt.Errorf("bad: %#v", resp)
}