Documentation ¶
Index ¶
- Constants
- Variables
- func APIRequestEnrich(ctx context.Context, handler *v1beta1.Handler, methodName string, req any) (any, error)
- func APIResponseEnrich(ctx context.Context, handler *v1beta1.Handler, methodName string, ...) any
- func ByteMimeWrapper(h http.Handler) http.Handler
- func CookieSameSite(name string) http.SameSite
- func EnrichCtxWithPassthroughEmail(identityHeader string) grpc.UnaryServerInterceptor
- func GatewayHeaderMatcherFunc(headerKeys map[string]bool) func(key string) (string, bool)
- func UnaryAPIRequestEnrich() grpc.UnaryServerInterceptor
- func UnaryAuthenticationCheck() grpc.UnaryServerInterceptor
- func UnaryAuthorizationCheck() grpc.UnaryServerInterceptor
- func UnaryCtxWithAudit(service *audit.Service) grpc.UnaryServerInterceptor
- func UnaryCtxWithStripeTestClock(ctx context.Context, handler *v1beta1.Handler, methodName string) context.Context
- func WithCors(h http.Handler, conf CorsConfig) http.Handler
- type CorsConfig
- type RawJSONPb
- type Session
Constants ¶
const (
// RawBytesMIME is the MIME type for raw bytes
RawBytesMIME = "application/raw-bytes"
)
Variables ¶
var ( ErrNotAvailable = fmt.Errorf("function not available at the moment") ErrDeniedInvalidArgs = status.Error(codes.PermissionDenied, "invalid arguments") )
var (
ErrStatusOrgProjectMismatch = status.Error(codes.InvalidArgument, "both project_id and org_id cannot be provided")
)
var (
RawPayloadEndpoints = []string{
"billing/webhooks/callback",
}
)
Functions ¶
func APIRequestEnrich ¶ added in v0.8.36
func APIResponseEnrich ¶ added in v0.8.41
func APIResponseEnrich(ctx context.Context, handler *v1beta1.Handler, methodName string, req, resp any) any
APIResponseEnrich is a unary server interceptor that enriches the response context with additional information based on the request expand field
func ByteMimeWrapper ¶ added in v0.13.0
ByteMimeWrapper is a custom runtime.ServeMuxOption that sets the content type to application/raw-bytes for specific endpoints. This is useful when the response is a raw byte array and should be serialized as is.
func CookieSameSite ¶ added in v0.7.4
func EnrichCtxWithPassthroughEmail ¶
func EnrichCtxWithPassthroughEmail(identityHeader string) grpc.UnaryServerInterceptor
func GatewayHeaderMatcherFunc ¶
GatewayHeaderMatcherFunc allows bypassing default runtime behaviour of prefixing headers with `grpc-gateway`
func UnaryAPIRequestEnrich ¶ added in v0.8.36
func UnaryAPIRequestEnrich() grpc.UnaryServerInterceptor
UnaryAPIRequestEnrich is a unary server interceptor that enriches the request context with additional information
func UnaryAuthenticationCheck ¶
func UnaryAuthenticationCheck() grpc.UnaryServerInterceptor
func UnaryAuthorizationCheck ¶
func UnaryAuthorizationCheck() grpc.UnaryServerInterceptor
UnaryAuthorizationCheck returns a unary server interceptor that checks for authorization
func UnaryCtxWithAudit ¶
func UnaryCtxWithAudit(service *audit.Service) grpc.UnaryServerInterceptor
Types ¶
type CorsConfig ¶ added in v0.7.4
type CorsConfig struct { AllowedOrigins []string `yaml:"allowed_origins" mapstructure:"allowed_origins" default:""` AllowedMethods []string `yaml:"allowed_methods" mapstructure:"allowed_methods" default:"GET POST PUT DELETE PATCH"` AllowedHeaders []string `yaml:"allowed_headers" mapstructure:"allowed_headers" default:"Authorization"` ExposedHeaders []string `yaml:"exposed_headers" mapstructure:"exposed_headers" default:"Content-Type"` }
type RawJSONPb ¶ added in v0.13.0
RawJSONPb is a custom runtime.JSONPb that reads the raw JSON data as is.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(cookieCutter securecookie.Codec, conf authenticate.SessionConfig) *Session
func (Session) GatewayResponseModifier ¶
func (h Session) GatewayResponseModifier(ctx context.Context, w http.ResponseWriter, _ proto.Message) error
GatewayResponseModifier https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/customizing_your_gateway/ called just before RPC server response gets serialized for gateway
func (Session) UnaryGRPCRequestHeadersAnnotator ¶
func (h Session) UnaryGRPCRequestHeadersAnnotator() grpc.UnaryServerInterceptor
UnaryGRPCRequestHeadersAnnotator converts session cookies set in grpc metadata to context this requires decrypting the cookie and setting it as context