Skip to content

Commit

Permalink
Merge 5d09718 into 3868112
Browse files Browse the repository at this point in the history
  • Loading branch information
scentless-apprentice committed Aug 25, 2020
2 parents 3868112 + 5d09718 commit 898f1d4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
36 changes: 17 additions & 19 deletions auth/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestResuseKeySource(t *testing.T) {
nextKeys := PublicKeySet{
Expiry: testTime.Add(2 * time.Second),
Keys: map[string]*rsa.PublicKey{
"8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle(testGoogleKey2), E: 65537},
},
}

Expand Down Expand Up @@ -104,8 +104,8 @@ func TestKeySetFromURL(t *testing.T) {
wantKeys: PublicKeySet{
Expiry: testTime.Add(1 * time.Second),
Keys: map[string]*rsa.PublicKey{
"728f4016652079b9ed99861bb09bafc5a45baa86": &rsa.PublicKey{N: testGoogle1, E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537},
"728f4016652079b9ed99861bb09bafc5a45baa86": {N: testGoogle(testGoogleKey1), E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": {N: testGoogle(testGoogleKey2), E: 65537},
},
},
},
Expand All @@ -117,8 +117,8 @@ func TestKeySetFromURL(t *testing.T) {
wantKeys: PublicKeySet{
Expiry: testTime.Add(5 * time.Second),
Keys: map[string]*rsa.PublicKey{
"728f4016652079b9ed99861bb09bafc5a45baa86": &rsa.PublicKey{N: testGoogle1, E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537},
"728f4016652079b9ed99861bb09bafc5a45baa86": {N: testGoogle(testGoogleKey1), E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": {N: testGoogle(testGoogleKey2), E: 65537},
},
},
},
Expand All @@ -145,8 +145,8 @@ func TestKeySetFromURL(t *testing.T) {
wantKeys: PublicKeySet{
Expiry: testTime.Add(5 * time.Second),
Keys: map[string]*rsa.PublicKey{
"728f4016652079b9ed99861bb09bafc5a45baa86": &rsa.PublicKey{N: testGoogle1, E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537},
"728f4016652079b9ed99861bb09bafc5a45baa86": {N: testGoogle(testGoogleKey1), E: 65537},
"8289d54280b76712de41cd2ef95972b123be9ac0": {N: testGoogle(testGoogleKey2), E: 65537},
},
},
},
Expand Down Expand Up @@ -181,20 +181,18 @@ func TestKeySetFromURL(t *testing.T) {
}

var (
testGoogleKey1 = "18112684417237113466774220553948287658642275536612278117358654328223325254239855900914880208928002193971790755769647369251185307648390933383803629253833792935549104394492595490970480288704258432536877269087694080352968836583401030682357884420432445619092471675752640354212779048186101852385524325549753366939320751885000360016238872619721767196169731422128756698973826778639560486979276112061913581353475855995717107174242233057925781337843224898645582603363390951368105740797845693907662079988391116580563176804122832211438500322243675724500523751141979116987975024595515232643410130766424608026731615327022863391377"
testGoogleKey2 = "22433090823316839640339489484457787676134304275873755218133861343920545237994470293495919014803004482856016084553850209153845425382613518932089311310596313310600424737736088033780907099977873221447195709312051528384355479077579673777886481089832045696620374920724411025483234264634539593436130076854768802102666090698524255278976644754677212286402099970599598264338136458077064875129043902522602870213617296706363155049264877048351659848686562003749244021217935734825983116131356048732262346697829165992404416525006735905763408678841171079087251498194471555953631250995421460080193870950448459655537601409828979901677"
testGoogle1 = func() *big.Int {
b := big.NewInt(0)
b.SetBytes([]byte(testGoogleKey1))
return b
}()
testGoogle2 = func() *big.Int {
b := big.NewInt(0)
b.SetBytes([]byte(testGoogleKey2))
return b
}()
testGoogleKey1 = "22433090823316839640339489484457787676134304275873755218133861343920545237994470293495919014803004482856016084553850209153845425382613518932089311310596313310600424737736088033780907099977873221447195709312051528384355479077579673777886481089832045696620374920724411025483234264634539593436130076854768802102666090698524255278976644754677212286402099970599598264338136458077064875129043902522602870213617296706363155049264877048351659848686562003749244021217935734825983116131356048732262346697829165992404416525006735905763408678841171079087251498194471555953631250995421460080193870950448459655537601409828979901677"
testGoogleKey2 = "18112684417237113466774220553948287658642275536612278117358654328223325254239855900914880208928002193971790755769647369251185307648390933383803629253833792935549104394492595490970480288704258432536877269087694080352968836583401030682357884420432445619092471675752640354212779048186101852385524325549753366939320751885000360016238872619721767196169731422128756698973826778639560486979276112061913581353475855995717107174242233057925781337843224898645582603363390951368105740797845693907662079988391116580563176804122832211438500322243675724500523751141979116987975024595515232643410130766424608026731615327022863391377"
)

func testGoogle(testKey string) *big.Int {
i, ok := new(big.Int).SetString(testKey, 10)
if !ok {
panic("bad number: " + testKey)
}
return i
}

const testGoogleCerts = `{
"keys": [
{
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3 h1:SRgJV+IoxM5MKyFdlSUeNy6/ycRUF2yBAKdAQswoHUk=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d h1:iaAPcMIY2f+gpk8tKf0BMW5sLrlhaASiYAnFmvVG5e0=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc=
Expand Down Expand Up @@ -402,6 +403,7 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ixkcwXThoiF6yf+R9scA=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e h1:hq86ru83GdWTlfQFZGO4nZJTU4Bs2wfHl8oFHRaXsfc=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -515,6 +517,7 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672 h1:jiDSspVssiikoRP
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940 h1:MRHtG0U6SnaUb+s+LhNE1qt1FQ1wlhqr5E4usBKC0uA=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84 h1:pSLkPbrjnPyLDYUO2VM9mDLqo2V6CFBY84lFSZAfoi4=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
Expand All @@ -538,6 +541,7 @@ google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zim
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/DataDog/dd-trace-go.v1 v1.22.0 h1:gpWsqqkwUldNZXGJqT69NU9MdEDhLboK1C4nMgR0MWw=
gopkg.in/DataDog/dd-trace-go.v1 v1.22.0/go.mod h1:DVp8HmDh8PuTu2Z0fVVlBsyWaC++fzwVCaGWylTe3tg=
Expand Down
2 changes: 1 addition & 1 deletion server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Config struct {
// JSONContentType can be used to override the default JSONContentType.
JSONContentType *string `envconfig:"GIZMO_JSON_CONTENT_TYPE"`
// MaxHeaderBytes can be used to override the default MaxHeaderBytes (1<<20).
MaxHeaderBytes *int `envconfig:"GIZMO_JSON_CONTENT_TYPE"`
MaxHeaderBytes *int `envconfig:"GIZMO_MAX_HEADER_BYTES"`
// ReadTimeout can be used to override the default http server timeout of 10s.
// The string should be formatted like a time.Duration string.
ReadTimeout *string `envconfig:"GIZMO_READ_TIMEOUT"`
Expand Down
2 changes: 1 addition & 1 deletion server/kit/kitserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,5 @@ func (s *server) getCatByName(ctx context.Context, _ interface{}) (interface{},
}

func (s *server) error(ctx context.Context, _ interface{}) (interface{}, error) {
return nil, errors.New("doh!")
return nil, errors.New("doh")
}

0 comments on commit 898f1d4

Please sign in to comment.