From 6c236867ce33c0c16b102e02a08226d7eb9b2046 Mon Sep 17 00:00:00 2001 From: Greg Steuck Date: Wed, 28 Jul 2021 15:34:03 -0700 Subject: syz-manager: support oauth when calling syz-hub Permit empty hub_key to indicate oauth. --- pkg/auth/jwt.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkg/auth') diff --git a/pkg/auth/jwt.go b/pkg/auth/jwt.go index 3e2313d11..f6d219323 100644 --- a/pkg/auth/jwt.go +++ b/pkg/auth/jwt.go @@ -101,7 +101,8 @@ func MakeCache(ctor func(method, url string, body io.Reader) (*http.Request, err // Get returns a potentially cached value of the token or renews as // necessary. The now parameter provides the current time for cache -// expiration. +// expiration. The returned value is suitable for Authorization header +// and syz-hub Key requests. func (cache *TokenCache) Get(now time.Time) (string, error) { cache.lock.Lock() defer cache.lock.Unlock() @@ -118,5 +119,5 @@ func (cache *TokenCache) Get(now time.Time) (string, error) { } cache.token = t } - return cache.token.value, nil + return "Bearer " + cache.token.value, nil } -- cgit mrf-deployment