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

Method ReadToken

config/config.go:254–269  ·  view source on GitHub ↗

ReadToken reads Kite Claims from JWT token and uses them to initialize Config.

(key *jwt.Token)

Source from the content-addressed store, hash-verified

252
253// ReadToken reads Kite Claims from JWT token and uses them to initialize Config.
254func (c *Config) ReadToken(key *jwt.Token) error {
255 c.KiteKey = key.Raw
256
257 claims, ok := key.Claims.(*kitekey.KiteClaims)
258 if !ok {
259 return errors.New("no claims found")
260 }
261
262 c.Username = claims.Subject
263 c.KontrolUser = claims.Issuer
264 c.Id = claims.Id // jti is used for jwt's but let's also use it for kite ID
265 c.KontrolURL = claims.KontrolURL
266 c.KontrolKey = claims.KontrolKey
267
268 return nil
269}
270
271// Copy returns a new copy of the config object.
272func (c *Config) Copy() *Config {

Callers 2

NewFromKiteKeyFunction · 0.95
ReadKiteKeyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected