Skip to content

Commit

Permalink
add auth and secret block to response test for hmac (#28283)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Wilson committed Sep 5, 2024
1 parent 047ec75 commit 3be1719
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions audit/hashstructure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,24 @@ func TestHashResponse(t *testing.T) {
CreationTime: now,
WrappedAccessor: "bar",
},
Auth: &logical.Auth{
ClientToken: "hvs.QWERTY-T1q5lEjIWux1Tjx-VGqAYJdd4FZtbp1wpD5Ym9pGh4KHGh2cy5TSjRndGoxaU44NzNscm5MSlRLQXZ0ZGg",
Accessor: "ABClk9ZNLGOCuTrOEIAooJG3",
TokenType: logical.TokenTypeService,
},
Secret: &logical.Secret{
LeaseOptions: logical.LeaseOptions{
TTL: 3,
MaxTTL: 5,
Renewable: false,
Increment: 1,
IssueTime: now,
},
InternalData: map[string]any{
"foo": "bar",
},
LeaseID: "abc",
},
}

req := &logical.Request{MountPoint: "/foo/bar"}
Expand All @@ -280,6 +298,11 @@ func TestHashResponse(t *testing.T) {
nonHMACDataKeys := []string{"baz"}

expected := &response{
Auth: &auth{
Accessor: "hmac-sha256:253184715b2d5a6c3a2fc7afe0d2294085f5e886a1275ca735646a6f23be2587",
ClientToken: "hmac-sha256:2ce541100a8bcd687e8ec7712c8bb4c975a8d8599c02d98945e63ecd413bf0f3",
TokenType: "service",
},
Data: map[string]interface{}{
"foo": "hmac-sha256:f9320baf0249169e73850cd6156ded0106e2bb6ad8cab01b7bbbebe6d1065317",
"baz": "foobar",
Expand All @@ -298,6 +321,9 @@ func TestHashResponse(t *testing.T) {
MountPoint: "/foo/bar",
MountRunningVersion: "123",
MountRunningSha256: "256-256!",
Secret: &secret{
LeaseID: "abc",
},
}

inmemStorage := &logical.InmemStorage{}
Expand Down

0 comments on commit 3be1719

Please sign in to comment.