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

Function AttachAuthToken

x/x.go:513–524  ·  view source on GitHub ↗

AttachAuthToken adds any incoming PoorMan's auth header data into the grpc context metadata

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

Source from the content-addressed store, hash-verified

511
512// AttachAuthToken adds any incoming PoorMan's auth header data into the grpc context metadata
513func AttachAuthToken(ctx context.Context, r *http.Request) context.Context {
514 if authToken := r.Header.Get("X-Dgraph-AuthToken"); authToken != "" {
515 md, ok := metadata.FromIncomingContext(ctx)
516 if !ok {
517 md = metadata.New(nil)
518 }
519
520 md.Append("auth-token", authToken)
521 ctx = metadata.NewIncomingContext(ctx, md)
522 }
523 return ctx
524}
525
526// AttachAccessJwt adds any incoming JWT header data into the grpc context metadata
527func AttachAccessJwt(ctx context.Context, r *http.Request) context.Context {

Callers 4

loginHandlerFunction · 0.92
alterHandlerFunction · 0.92
resolveWithAdminServerFunction · 0.92
ServeHTTPMethod · 0.92

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected