src/plugin/vault/pachyderm/revoke.go
func (b *backend) Revoke(ctx context.Context, req *logical.Request, data *framework.FieldData) (resp *logical.Response, retErr error) {
	b.Logger().Debug(fmt.Sprintf("(%s) %s received at %s", req.ID, req.Operation, req.Path))
	defer func() {
		b.Logger().Debug(fmt.Sprintf("(%s) %s finished at %s with result (success=%t)", req.ID, req.Operation, req.Path, retErr == nil && !resp.IsError()))
	}()

	// Extract pachyderm token from vault secret
	tokenIface, ok := req.Secret.InternalData["user_token"]
	if !ok {
		return nil, fmt.Errorf("secret is missing user_token")
	}
	userToken, ok := tokenIface.(string)
	if !ok {
		return nil, fmt.Errorf("secret.user_token has wrong type (expected string but was %T)", tokenIface)
	}

	// Get pach address and admin token from config
	config, err := getConfig(ctx, req.Storage)
	if err != nil {
		return nil, err
	}
	if len(config.AdminToken) == 0 {
		return nil, errors.New("plugin is missing admin token")
	}
	if len(config.PachdAddress) == 0 {
		return nil, errors.New("plugin is missing pachd address")
	}

	// Revoke creds
	err = revokeUserCredentials(ctx, config.PachdAddress, userToken, config.AdminToken)
	if err != nil {
		return nil, err
	}

	return &logical.Response{}, nil
}
func (b *backend) Revoke(ctx context.Context, req *logical.Request, data *framework.FieldData) (resp *logical.Response, retErr error) {
	b.Logger().Debug(fmt.Sprintf("(%s) %s received at %s", req.ID, req.Operation, req.Path))
	defer func() {
		b.Logger().Debug(fmt.Sprintf("(%s) %s finished at %s with result (success=%t)", req.ID, req.Operation, req.Path, retErr == nil && !resp.IsError()))
	}()

	// Extract pachyderm token from vault secret
	tokenIface, ok := req.Secret.InternalData["user_token"]
	if !ok {
		return nil, fmt.Errorf("secret is missing user_token")
	}
	userToken, ok := tokenIface.(string)
	if !ok {
		return nil, fmt.Errorf("secret.user_token has wrong type (expected string but was %T)", tokenIface)
	}

	// Get pach address and admin token from config
	config, err := getConfig(ctx, req.Storage)
	if err != nil {
		return nil, err
	}
	if len(config.AdminToken) == 0 {
		return nil, errors.New("plugin is missing admin token")
	}
	if len(config.PachdAddress) == 0 {
		return nil, errors.New("plugin is missing pachd address")
	}

	// Revoke creds
	err = revokeUserCredentials(ctx, config.PachdAddress, userToken, config.AdminToken)
	if err != nil {
		return nil, err
	}

	return &logical.Response{}, nil
}
// Revoke revokes the caller's credentials (by sending a request to Pachyderm).
// Unlike other handlers, it doesn't get assigned to a path; instead it's
// called by the vault lease API when a token's lease expires or is revoked.
// It's set in Backend.Secrets[0].Revoke in backend.go