Skip to content

Commit

Permalink
cubbyhole-response-wrapping -> response-wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Jun 10, 2016
1 parent 1e67cd8 commit c6ded38
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions http/sys_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func TestSysPolicies(t *testing.T) {

var actual map[string]interface{}
expected := map[string]interface{}{
"policies": []interface{}{"cubbyhole-response-wrapping", "default", "root"},
"keys": []interface{}{"cubbyhole-response-wrapping", "default", "root"},
"policies": []interface{}{"response-wrapping", "default", "root"},
"keys": []interface{}{"response-wrapping", "default", "root"},
}
testResponseStatus(t, resp, 200)
testResponseBody(t, resp, &actual)
Expand Down Expand Up @@ -62,16 +62,16 @@ func TestSysWritePolicy(t *testing.T) {

var actual map[string]interface{}
expected := map[string]interface{}{
"policies": []interface{}{"cubbyhole-response-wrapping", "default", "foo", "root"},
"keys": []interface{}{"cubbyhole-response-wrapping", "default", "foo", "root"},
"policies": []interface{}{"response-wrapping", "default", "foo", "root"},
"keys": []interface{}{"response-wrapping", "default", "foo", "root"},
}
testResponseStatus(t, resp, 200)
testResponseBody(t, resp, &actual)
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("bad: got\n%#v\nexpected\n%#v\n", actual, expected)
}

resp = testHttpPost(t, token, addr+"/v1/sys/policy/cubbyhole-response-wrapping", map[string]interface{}{
resp = testHttpPost(t, token, addr+"/v1/sys/policy/response-wrapping", map[string]interface{}{
"rules": ``,
})
testResponseStatus(t, resp, 400)
Expand All @@ -94,14 +94,14 @@ func TestSysDeletePolicy(t *testing.T) {
// Also attempt to delete these since they should not be allowed (ignore
// responses, if they exist later that's sufficient)
resp = testHttpDelete(t, token, addr+"/v1/sys/policy/default")
resp = testHttpDelete(t, token, addr+"/v1/sys/policy/cubbyhole-response-wrapping")
resp = testHttpDelete(t, token, addr+"/v1/sys/policy/response-wrapping")

resp = testHttpGet(t, token, addr+"/v1/sys/policy")

var actual map[string]interface{}
expected := map[string]interface{}{
"policies": []interface{}{"cubbyhole-response-wrapping", "default", "root"},
"keys": []interface{}{"cubbyhole-response-wrapping", "default", "root"},
"policies": []interface{}{"response-wrapping", "default", "root"},
"keys": []interface{}{"response-wrapping", "default", "root"},
}
testResponseStatus(t, resp, 200)
testResponseBody(t, resp, &actual)
Expand Down
12 changes: 6 additions & 6 deletions vault/logical_system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ func TestSystemBackend_policyList(t *testing.T) {
}

exp := map[string]interface{}{
"keys": []string{"cubbyhole-response-wrapping", "default", "root"},
"policies": []string{"cubbyhole-response-wrapping", "default", "root"},
"keys": []string{"response-wrapping", "default", "root"},
"policies": []string{"response-wrapping", "default", "root"},
}
if !reflect.DeepEqual(resp.Data, exp) {
t.Fatalf("got: %#v expect: %#v", resp.Data, exp)
Expand Down Expand Up @@ -663,8 +663,8 @@ func TestSystemBackend_policyCRUD(t *testing.T) {
}

exp = map[string]interface{}{
"keys": []string{"cubbyhole-response-wrapping", "default", "foo", "root"},
"policies": []string{"cubbyhole-response-wrapping", "default", "foo", "root"},
"keys": []string{"response-wrapping", "default", "foo", "root"},
"policies": []string{"response-wrapping", "default", "foo", "root"},
}
if !reflect.DeepEqual(resp.Data, exp) {
t.Fatalf("got: %#v expect: %#v", resp.Data, exp)
Expand Down Expand Up @@ -698,8 +698,8 @@ func TestSystemBackend_policyCRUD(t *testing.T) {
}

exp = map[string]interface{}{
"keys": []string{"cubbyhole-response-wrapping", "default", "root"},
"policies": []string{"cubbyhole-response-wrapping", "default", "root"},
"keys": []string{"response-wrapping", "default", "root"},
"policies": []string{"response-wrapping", "default", "root"},
}
if !reflect.DeepEqual(resp.Data, exp) {
t.Fatalf("got: %#v expect: %#v", resp.Data, exp)
Expand Down
2 changes: 1 addition & 1 deletion vault/policy_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
policyCacheSize = 1024

// cubbyholeResponseWrappingPolicyName is the name of the fixed policy
cubbyholeResponseWrappingPolicyName = "cubbyhole-response-wrapping"
cubbyholeResponseWrappingPolicyName = "response-wrapping"

// cubbyholeResponseWrappingPolicy is the policy that ensures cubbyhole
// response wrapping can always succeed
Expand Down
4 changes: 2 additions & 2 deletions vault/policy_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ func TestPolicyStore_Predefined(t *testing.T) {
if err != nil {
t.Fatalf("err: %v", err)
}
if len(out) != 2 || out[0] != "cubbyhole-response-wrapping" || out[1] != "default" {
if len(out) != 2 || out[0] != "response-wrapping" || out[1] != "default" {
t.Fatalf("bad: %v", out)
}

pCubby, err := core.policyStore.GetPolicy("cubbyhole-response-wrapping")
pCubby, err := core.policyStore.GetPolicy("response-wrapping")
if err != nil {
t.Fatalf("err: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions vault/request_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (c *Core) wrapInCubbyhole(req *logical.Request, resp *logical.Response) (*l
creationTime := time.Now()
te := TokenEntry{
Path: req.Path,
Policies: []string{"cubbyhole-response-wrapping"},
Policies: []string{"response-wrapping"},
CreationTime: creationTime.Unix(),
TTL: resp.WrapInfo.TTL,
NumUses: 1,
Expand Down Expand Up @@ -432,7 +432,7 @@ func (c *Core) wrapInCubbyhole(req *logical.Request, resp *logical.Response) (*l

auth := &logical.Auth{
ClientToken: te.ID,
Policies: []string{"cubbyhole-response-wrapping"},
Policies: []string{"response-wrapping"},
LeaseOptions: logical.LeaseOptions{
TTL: te.TTL,
Renewable: false,
Expand Down

0 comments on commit c6ded38

Please sign in to comment.