AttachAccessJwt adds any incoming JWT header data into the grpc context metadata
(ctx context.Context, r *http.Request)
| 525 | |
| 526 | // AttachAccessJwt adds any incoming JWT header data into the grpc context metadata |
| 527 | func 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 |
| 541 | func AttachRemoteIP(ctx context.Context, r *http.Request) context.Context { |
no test coverage detected