MCPcopy Create free account
hub / github.com/koding/kite / verifyInit

Method verifyInit

request.go:318–356  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

316}
317
318func (k *Kite) verifyInit() {
319 k.configMu.Lock()
320 defer k.configMu.Unlock()
321
322 k.verifyFunc = k.Config.VerifyFunc
323
324 if k.verifyFunc == nil {
325 k.verifyFunc = k.selfVerify
326 }
327
328 k.verifyAudienceFunc = k.Config.VerifyAudienceFunc
329
330 if k.verifyAudienceFunc == nil {
331 k.verifyAudienceFunc = k.verifyAudience
332 }
333
334 ttl := k.Config.VerifyTTL
335
336 if ttl == 0 {
337 ttl = 5 * time.Minute
338 }
339
340 if ttl > 0 {
341 k.mu.Lock()
342 k.verifyCache = cache.NewMemoryWithTTL(ttl)
343 k.mu.Unlock()
344
345 k.verifyCache.StartGC(ttl / 2)
346 }
347
348 key, err := jwt.ParseRSAPublicKeyFromPEM([]byte(k.Config.KontrolKey))
349 if err != nil {
350 k.Log.Error("unable to init kontrol key: %s", err)
351
352 return
353 }
354
355 k.kontrolKey = key
356}
357
358func (k *Kite) selfVerify(pub string) error {
359 k.configMu.RLock()

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected