MCPcopy Index your code
hub / github.com/koding/kite / GetTokenForce

Method GetTokenForce

kontrolclient.go:224–248  ·  view source on GitHub ↗

GetTokenForce is used to obtain a new token for the given kite. It always returns a new token and forces a Kontrol to forget about any previous ones.

(kite *protocol.Kite)

Source from the content-addressed store, hash-verified

222// It always returns a new token and forces a Kontrol to
223// forget about any previous ones.
224func (k *Kite) GetTokenForce(kite *protocol.Kite) (string, error) {
225 if err := k.SetupKontrolClient(); err != nil {
226 return "", err
227 }
228
229 <-k.kontrol.readyConnected
230
231 args := &protocol.GetTokenArgs{
232 KontrolQuery: *kite.Query(),
233 Force: true,
234 }
235
236 result, err := k.kontrol.TellWithTimeout("getToken", k.Config.Timeout, args)
237 if err != nil {
238 return "", err
239 }
240
241 var tkn string
242 err = result.Unmarshal(&tkn)
243 if err != nil {
244 return "", err
245 }
246
247 return tkn, nil
248}
249
250// GetKey is used to get a new public key from kontrol if the current one is
251// invalidated. The key is also replaced in memory and every request is going

Callers 1

TestTokenInvalidationFunction · 0.80

Calls 4

SetupKontrolClientMethod · 0.95
QueryMethod · 0.80
TellWithTimeoutMethod · 0.80
UnmarshalMethod · 0.80

Tested by 1

TestTokenInvalidationFunction · 0.64