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