MCPcopy
hub / github.com/dgraph-io/dgraph / AttachAccessJwt

Function AttachAccessJwt

x/x.go:527–538  ·  view source on GitHub ↗

AttachAccessJwt adds any incoming JWT header data into the grpc context metadata

(ctx context.Context, r *http.Request)

Source from the content-addressed store, hash-verified

525
526// AttachAccessJwt adds any incoming JWT header data into the grpc context metadata
527func AttachAccessJwt(ctx context.Context, r *http.Request) context.Context {
528 if accessJwt := r.Header.Get("X-Dgraph-AccessToken"); accessJwt != "" {
529 md, ok := metadata.FromIncomingContext(ctx)
530 if !ok {
531 md = metadata.New(nil)
532 }
533
534 md.Append("accessJwt", accessJwt)
535 ctx = metadata.NewIncomingContext(ctx, md)
536 }
537 return ctx
538}
539
540// AttachRemoteIP adds any incoming IP data into the grpc context metadata
541func AttachRemoteIP(ctx context.Context, r *http.Request) context.Context {

Callers 11

queryHandlerFunction · 0.92
mutationHandlerFunction · 0.92
commitHandlerFunction · 0.92
alterHandlerFunction · 0.92
resolveWithAdminServerFunction · 0.92
healthCheckFunction · 0.92
stateHandlerFunction · 0.92
AddSubscriberMethod · 0.92
pollMethod · 0.92
ServeHTTPMethod · 0.92
ExtractNamespaceHTTPFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected