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.
This commit is contained in:
John-Michael Faircloth 2021-06-21 13:38:22 -05:00 committed by GitHub
parent 625bf466f1
commit f42070ac6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,