featurebase/server
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/certs Supply "subject alternative name" for TLS certificates 2020-10-20 14:14:26 -05:00
cluster_test.go listen on localhost:0 instead of :0 2022-03-18 13:38:30 -05:00
config.go FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070) 2022-05-20 14:57:05 -05:00
config_internal_test.go FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070) 2022-05-20 14:57:05 -05:00
config_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
dup.go add copyright notice back in 2021-12-10 11:01:04 -06:00
dup_arm64.go add copyright notice back in 2021-12-10 11:01:04 -06:00
grpc.go Add refresh token header/cookie (#2071) 2022-05-20 16:12:27 -05:00
grpc_internal_test.go Add refresh token header/cookie (#2071) 2022-05-20 16:12:27 -05:00
grpc_test.go add tests for sql WHERE clause with timestamps 2022-03-03 22:20:49 -06:00
handler_test.go increase test coverage 2022-03-15 11:01:03 -05:00
pg.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
pg_internal_test.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
pg_test.go FB-1188 - Added TTL field option 2022-02-25 11:39:31 -06:00
server.go FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070) 2022-05-20 14:57:05 -05:00
server_internal_test.go addresses multiple authn/z tickets 2022-01-14 12:31:32 -06:00
server_test.go update tests to reflect recent changes around allowing things when 2022-04-28 14:09:32 -05:00
sql.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
tlsconfig.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
trial.go Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00