2020-03-23 07:01:59 +01:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/grpc-ecosystem/go-grpc-middleware/util/metautils"
|
2020-08-24 10:06:55 +02:00
|
|
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
2020-03-23 07:01:59 +01:00
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/api/http"
|
2020-03-23 07:01:59 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func GetHeader(ctx context.Context, headername string) string {
|
|
|
|
return metautils.ExtractIncoming(ctx).Get(headername)
|
|
|
|
}
|
|
|
|
|
2020-08-24 10:06:55 +02:00
|
|
|
func GetGatewayHeader(ctx context.Context, headername string) string {
|
|
|
|
return GetHeader(ctx, runtime.MetadataPrefix+headername)
|
|
|
|
}
|
|
|
|
|
2020-03-23 07:01:59 +01:00
|
|
|
func GetAuthorizationHeader(ctx context.Context) string {
|
2020-07-08 13:56:37 +02:00
|
|
|
return GetHeader(ctx, http.Authorization)
|
2020-03-23 07:01:59 +01:00
|
|
|
}
|