From f42070ac6c48487ee4ee17dc92a056d71ea41af1 Mon Sep 17 00:00:00 2001 From: John-Michael Faircloth Date: Mon, 21 Jun 2021 13:38:22 -0500 Subject: [PATCH] approle: convert Callbacks to Operations (#11893) * approle: convert Callbacks to Operations The usage of oldstyle "Callbacks" is causing the `cannot write to readonly storage` error message when `login` is attempted against a performance standby. Use the newstyle "Operations" and additionally set the Forward parameters to forward the request to the Active vault node. * add changelog * do not forward for alias lookahead operation * remove forward fields and remove changelog - Because this request is an UpdateOperation, it should have automatically been routed to the primary/active by the router before it reaches the backend. - changelog should not be needed as this change is only a refactor with no user-facing behavior changes. --- builtin/credential/approle/path_login.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin/credential/approle/path_login.go b/builtin/credential/approle/path_login.go index a9d1694dc844a..104b9015b92db 100644 --- a/builtin/credential/approle/path_login.go +++ b/builtin/credential/approle/path_login.go @@ -26,9 +26,13 @@ func pathLogin(b *backend) *framework.Path { Description: "SecretID belong to the App role", }, }, - Callbacks: map[logical.Operation]framework.OperationFunc{ - logical.UpdateOperation: b.pathLoginUpdate, - logical.AliasLookaheadOperation: b.pathLoginUpdateAliasLookahead, + Operations: map[logical.Operation]framework.OperationHandler{ + logical.UpdateOperation: &framework.PathOperation{ + Callback: b.pathLoginUpdate, + }, + logical.AliasLookaheadOperation: &framework.PathOperation{ + Callback: b.pathLoginUpdateAliasLookahead, + }, }, HelpSynopsis: pathLoginHelpSys, HelpDescription: pathLoginHelpDesc,