featurebase/ctl
reesporte 60e6900c2e
Add refresh token header/cookie (#2071)
* Add refresh token header/cookie

As part of work on automatic refreshing of access tokens in the grafana plugin
(FB-1377), we will now accept a refresh token in the "X-Molecula-Refresh-Token"
header or the "refresh-molecula-chip" cookie.

This refresh token will be used if the access token is expired. To achieve this,
there was a lot of plumbing that had to be done. Here is a list of some of it:

* Added lots of constants for the new values.
* Removed token cache, since we will be keeping state on the clients.
* We now only refresh tokens when they are expired, which is more inline with the
  OAuth spec.
* Refactored SetGRPCMetadata to be simpler to read.
* Refactored AddAuthToken.
* Update failing tests.
* We now don't split GRPC cookies on ";". Not sure why we did that before tbh.

I also added TODOs to add the refresh token to other subcommands. This is out of
scope for my current ticket, but it would be nice to have in the future.

* remove unnecessary context from Authenticate

* Add comments on why we check both cases for headers

It's because some GRPC clients lowercase metadata names. I've run into issues with
this enough that I think it's worth the extra checks. We prefer lowercase though,
because that's "standard".

* Fix test that broke during rebase
2022-05-20 16:12:27 -05:00
..
testdata Enable authentication/authorization for featurebase tools 2022-01-26 17:30:26 -06:00
backup.go Add refresh token header/cookie (#2071) 2022-05-20 16:12:27 -05:00
chksum.go remove http subpackage and bring implementations into core 2022-02-03 21:04:04 -06:00
common.go remove http subpackage and bring implementations into core 2022-02-03 21:04:04 -06:00
config.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
config_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
doc.go add copyright notice back in 2021-12-10 11:01:04 -06:00
export.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
export_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
generate_config.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
generate_config_test.go add copyright notice back in 2021-12-10 11:01:04 -06:00
import.go Add refresh token header/cookie (#2071) 2022-05-20 16:12:27 -05:00
import_test.go Add refresh token header/cookie (#2071) 2022-05-20 16:12:27 -05:00
keygen.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
main_test.go listen on localhost:0 instead of :0 2022-03-18 13:38:30 -05:00
rbf_check.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
rbf_check_test.go Avoid panics in RBF debug tooling 2022-01-03 13:13:02 -07:00
rbf_dump.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
rbf_page.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
rbf_pages.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
rbf_pages_test.go Avoid panics in RBF debug tooling 2022-01-03 13:13:02 -07:00
restore.go Add refresh token header/cookie (#2071) 2022-05-20 16:12:27 -05:00
server.go FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070) 2022-05-20 14:57:05 -05:00
server_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
util.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00