databroker: require JWT for access (#1503)

This commit is contained in:
Caleb Doxsey 2020-10-09 11:08:40 -06:00 committed by GitHub
parent 27d0cf180a
commit eb79cc0957
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 188 additions and 79 deletions

View file

@ -2,6 +2,7 @@ package databroker
import (
"context"
"encoding/base64"
"errors"
"sync"
"time"
@ -138,6 +139,7 @@ func (src *ConfigSource) rebuild(firstTime bool) {
}
func (src *ConfigSource) runUpdater(cfg *config.Config) {
sharedKey, _ := base64.StdEncoding.DecodeString(cfg.Options.SharedKey)
connectionOptions := &grpc.Options{
Addr: cfg.Options.DataBrokerURL,
OverrideCertificateName: cfg.Options.OverrideCertificateName,
@ -147,6 +149,7 @@ func (src *ConfigSource) runUpdater(cfg *config.Config) {
ClientDNSRoundRobin: cfg.Options.GRPCClientDNSRoundRobin,
WithInsecure: cfg.Options.GRPCInsecure,
ServiceName: cfg.Options.Services,
SignedJWTKey: sharedKey,
}
h, err := hashstructure.Hash(connectionOptions, nil)
if err != nil {