AttachAuthToken adds any incoming PoorMan's auth header data into the grpc context metadata
(ctx context.Context, r *http.Request)
| 511 | |
| 512 | // AttachAuthToken adds any incoming PoorMan's auth header data into the grpc context metadata |
| 513 | func 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 |
| 527 | func AttachAccessJwt(ctx context.Context, r *http.Request) context.Context { |
no test coverage detected