Skip to content

Commit

Permalink
approle: convert Callbacks to Operations (#11893)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
fairclothjm committed Jun 21, 2021
1 parent 625bf46 commit f42070a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions builtin/credential/approle/path_login.go
Expand Up @@ -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,
Expand Down

0 comments on commit f42070a

Please sign in to comment.