Add creation time to returned wrapped token info

This makes it easier to understand the expected lifetime without a
lookup call that uses the single use left on the token.

This also adds a couple of safety checks and for JSON uses int, rather
than int64, for the TTL for the wrapped token.
This commit is contained in:
Jeff Mitchell
2016-06-07 15:00:35 -04:00
parent 83771f1e72
commit 91053b7471
11 changed files with 51 additions and 27 deletions

View File

@@ -68,8 +68,9 @@ func TestCopy_response(t *testing.T) {
"foo": "bar",
},
WrapInfo: &logical.WrapInfo{
TTL: 60,
Token: "foo",
TTL: 60,
Token: "foo",
CreationTime: 100000,
},
}
arg := expected
@@ -137,8 +138,9 @@ func TestHash(t *testing.T) {
"foo": "bar",
},
WrapInfo: &logical.WrapInfo{
TTL: 60,
Token: "bar",
TTL: 60,
Token: "bar",
CreationTime: 100000,
},
},
&logical.Response{
@@ -146,8 +148,9 @@ func TestHash(t *testing.T) {
"foo": "hmac-sha256:f9320baf0249169e73850cd6156ded0106e2bb6ad8cab01b7bbbebe6d1065317",
},
WrapInfo: &logical.WrapInfo{
TTL: 60,
Token: "hmac-sha256:f9320baf0249169e73850cd6156ded0106e2bb6ad8cab01b7bbbebe6d1065317",
TTL: 60,
Token: "hmac-sha256:f9320baf0249169e73850cd6156ded0106e2bb6ad8cab01b7bbbebe6d1065317",
CreationTime: 100000,
},
},
},