MCPcopy Create free account
hub / github.com/cloudwan/gohan / VerifyToken

Method VerifyToken

server/middleware/cached.go:34–45  ·  view source on GitHub ↗
(token string)

Source from the content-addressed store, hash-verified

32}
33
34func (c *CachedIdentityService) VerifyToken(token string) (schema.Authorization, error) {
35 i, ok := c.cache.Get(token)
36 if ok {
37 return i.(schema.Authorization), nil
38 }
39 a, err := c.inner.VerifyToken(token)
40 if err != nil {
41 return nil, err
42 }
43 c.cache.Set(token, a, cache.DefaultExpiration)
44 return a, nil
45}
46
47func (c *CachedIdentityService) GetServiceAuthorization() (schema.Authorization, error) {
48 return c.VerifyToken(c.GetClient().TokenID)

Callers 1

Calls 3

GetMethod · 0.65
VerifyTokenMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected