MCPcopy
hub / github.com/google/gvisor / CredentialsFromContext

Function CredentialsFromContext

pkg/sentry/kernel/auth/context.go:35–40  ·  view source on GitHub ↗

CredentialsFromContext returns the Credentials used by ctx, or a set of Credentials with no capabilities if ctx does not have Credentials.

(ctx context.Context)

Source from the content-addressed store, hash-verified

33// CredentialsFromContext returns the Credentials used by ctx, or a
34// set of Credentials with no capabilities if ctx does not have Credentials.
35func CredentialsFromContext(ctx context.Context) *Credentials {
36 if v := ctx.Value(CtxCredentials); v != nil {
37 return v.(*Credentials)
38 }
39 return NewAnonymousCredentials()
40}
41
42// CredentialsOrNilFromContext returns a copy of the Credentials used by ctx,
43// or nil if ctx does not have Credentials.

Callers 15

OpenMethod · 0.92
ConfigureMMapMethod · 0.92
OpenMethod · 0.92
NewNullFDFunction · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92

Calls 2

NewAnonymousCredentialsFunction · 0.85
ValueMethod · 0.65

Tested by 15

newTestSystemFunction · 0.74
NewDirMethod · 0.74
NewFileMethod · 0.74
TestGetExecUserHomeFunction · 0.74
newResolveTestVFSFunction · 0.74
newTestSystemFunction · 0.74
setupDevFunction · 0.74
setupFunction · 0.74
newTestConnectionFunction · 0.74
TestConnectionAbortFunction · 0.74
TestFUSECommunicationFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…