MCPcopy Index your code
hub / github.com/coder/coder / ActorFromContext

Function ActorFromContext

coderd/database/dbauthz/dbauthz.go:211–214  ·  view source on GitHub ↗

ActorFromContext returns the authorization subject from the context. All authentication flows should set the authorization subject in the context. If no actor is present, the function returns false.

(ctx context.Context)

Source from the content-addressed store, hash-verified

209// All authentication flows should set the authorization subject in the context.
210// If no actor is present, the function returns false.
211func ActorFromContext(ctx context.Context) (rbac.Subject, bool) {
212 a, ok := ctx.Value(authContextKey{}).(rbac.Subject)
213 return a, ok
214}
215
216var (
217 subjectProvisionerd = rbac.Subject{

Callers 15

SubscribeMethod · 0.92
AuthorizeContextMethod · 0.92
TestAPIKeyFunction · 0.92
TestAsAuthzSystemFunction · 0.92
AsAuthzSystemFunction · 0.92
assertRBACNoLockMethod · 0.92
AcquireMethod · 0.92
TestAsNoActorFunction · 0.92
TestAsChatdFunction · 0.92

Calls 1

ValueMethod · 0.45

Tested by 7

TestAPIKeyFunction · 0.74
TestAsAuthzSystemFunction · 0.74
TestAsNoActorFunction · 0.74
TestAsChatdFunction · 0.74
MatchesMethod · 0.74