1c190d4bda
* Start work on passing context to backends * More work on passing context * Unindent logical system * Unindent token store * Unindent passthrough * Unindent cubbyhole * Fix tests * use requestContext in rollback and expiration managers
29 lines
628 B
Go
29 lines
628 B
Go
package mock
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hashicorp/vault/logical"
|
|
"github.com/hashicorp/vault/logical/framework"
|
|
)
|
|
|
|
// pathSpecial is used to test special paths.
|
|
func pathSpecial(b *backend) *framework.Path {
|
|
return &framework.Path{
|
|
Pattern: "special",
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
|
logical.ReadOperation: b.pathSpecialRead,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (b *backend) pathSpecialRead(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
|
|
// Return the secret
|
|
return &logical.Response{
|
|
Data: map[string]interface{}{
|
|
"data": "foo",
|
|
},
|
|
}, nil
|
|
|
|
}
|