Merge pull request #1306 from hashicorp/fix-token-ttl-display
Construct token path from request to fix displaying TTLs when using
This commit is contained in:
commit
3de7dd324b
|
@ -844,8 +844,13 @@ func (ts *TokenStore) handleCreateCommon(
|
||||||
|
|
||||||
// Setup the token entry
|
// Setup the token entry
|
||||||
te := TokenEntry{
|
te := TokenEntry{
|
||||||
Parent: req.ClientToken,
|
Parent: req.ClientToken,
|
||||||
Path: "auth/token/create",
|
|
||||||
|
// The mount point is always the same since we have only one token
|
||||||
|
// store; using req.MountPoint causes trouble in tests since they don't
|
||||||
|
// have an official mount
|
||||||
|
Path: fmt.Sprintf("auth/token/%s", req.Path),
|
||||||
|
|
||||||
Meta: data.Metadata,
|
Meta: data.Metadata,
|
||||||
DisplayName: "token",
|
DisplayName: "token",
|
||||||
NumUses: data.NumUses,
|
NumUses: data.NumUses,
|
||||||
|
@ -860,7 +865,6 @@ func (ts *TokenStore) handleCreateCommon(
|
||||||
if role != nil {
|
if role != nil {
|
||||||
te.Role = role.Name
|
te.Role = role.Name
|
||||||
|
|
||||||
te.Path = fmt.Sprintf("%s/%s", te.Path, role.Name)
|
|
||||||
if role.PathSuffix != "" {
|
if role.PathSuffix != "" {
|
||||||
te.Path = fmt.Sprintf("%s/%s", te.Path, role.PathSuffix)
|
te.Path = fmt.Sprintf("%s/%s", te.Path, role.PathSuffix)
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,7 +518,7 @@ func TestTokenStore_HandleRequest_CreateToken_DisplayName(t *testing.T) {
|
||||||
}
|
}
|
||||||
expected.CreationTime = out.CreationTime
|
expected.CreationTime = out.CreationTime
|
||||||
if !reflect.DeepEqual(out, expected) {
|
if !reflect.DeepEqual(out, expected) {
|
||||||
t.Fatalf("bad: %#v", out)
|
t.Fatalf("bad:\ngot:\n%#v\nexpected:\n%#v\n", out, expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue