MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / AuthInfo

Method AuthInfo

pkg/auth/rights/cache.go:176–196  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

174}
175
176func (f *inMemoryCache) AuthInfo(ctx context.Context) (authInfo *ttnpb.AuthInfoResponse, err error) {
177 defer func() { registerAuthInfoRequest(ctx, authInfo, err) }()
178 req := newReq(ctx)
179 f.mu.Lock()
180 res := f.authInfo[req]
181 if !res.valid(f.successTTL, f.errorTTL) {
182 res = &cachedAuthInfoRes{
183 cachedRes: newRes(),
184 }
185 f.authInfo[req] = res
186 go func() {
187 res.set(f.Fetcher.AuthInfo(ctx))
188 }()
189 }
190 f.maybeCleanup()
191 f.mu.Unlock()
192 if err := res.wait(ctx); err != nil {
193 return nil, err
194 }
195 return res.authInfo, res.err
196}
197
198func (f *inMemoryCache) ApplicationRights(ctx context.Context, appID *ttnpb.ApplicationIdentifiers) (rights *ttnpb.Rights, err error) {
199 defer func() { registerRightsRequest(ctx, "application", rights, err) }()

Callers

nothing calls this directly

Calls 8

maybeCleanupMethod · 0.95
registerAuthInfoRequestFunction · 0.85
newReqFunction · 0.85
newResFunction · 0.85
waitMethod · 0.80
AuthInfoMethod · 0.65
validMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected