Documentation
¶
Index ¶
- Variables
- func DecodeJSONRequest[T any](_ context.Context, r *http.Request) (interface{}, error)
- func DecodeNoBodyRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodePathParameters[T any](_ context.Context, r *http.Request) (interface{}, error)
- func DefaultErr2Status(err error) int
- func EncodeResponse(err2Status func(error) int) func(context.Context, http.ResponseWriter, interface{}) error
- func Err2Str(err error) string
- func ErrorEncoder(err2Status func(error) int) func(_ context.Context, err error, w http.ResponseWriter)
- func GRPCDecodeNoBody(_ context.Context, req interface{}) (interface{}, error)
- func GRPCDecodeToObject[T any](_ context.Context, request interface{}) (interface{}, error)
- func GRPCLoggingServerOptions(logger log.Logger) []grpctransport.ServerOption
- func GetStandardClaimsFromContext(ctx context.Context) (*jwt.RegisteredClaims, error)
- func GetUserIdFromContext(ctx context.Context) (string, error)
- func HTTPLoggingServerOptions(logger log.Logger) []httptransport.ServerOption
- func JWTKeyFactory(viper viper.Viper) func(token *jwt.Token) (interface{}, error)
- func NewParser(keyFunc jwt.Keyfunc, method jwt.SigningMethod, newClaims ClaimsFactory) endpoint.Middleware
- func RegisteredClaimsFactory() jwt.Claims
- func SetConnectionStringConfig(viper *viper.Viper)
- type ClaimsFactory
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InsecureSkipVerifyKey = "INSECURE_SKIP_VERIFY" HTTPPortKey = "HTTP_PORT" GRPCPortKey = "GRPC_PORT" DBHostKey = "DB_HOST" DBPortKey = "DB_PORT" DBUserKey = "DB_USER" DBPassKey = "DB_PASS" DBConnectionStringKey = "DB_CONNECTION_STRING" CertsEndpointKey = "CERTS_ENDPOINT" JWTSecretKey = "JWT_SECRET" IntrospectionEndpointKey = "INTROSPECTION_ENDPOINT" ClientIdKey = "CLIENT_ID" ClientSecretKey = "CLIENT_SECRET" )
Functions ¶
func DecodeJSONRequest ¶
func DecodeNoBodyRequest ¶
func DecodePathParameters ¶
func DefaultErr2Status ¶
func EncodeResponse ¶
func ErrorEncoder ¶
func GRPCDecodeNoBody ¶
func GRPCDecodeToObject ¶
func GRPCLoggingServerOptions ¶
func GRPCLoggingServerOptions(logger log.Logger) []grpctransport.ServerOption
func GetStandardClaimsFromContext ¶
func GetStandardClaimsFromContext(ctx context.Context) (*jwt.RegisteredClaims, error)
func HTTPLoggingServerOptions ¶
func HTTPLoggingServerOptions(logger log.Logger) []httptransport.ServerOption
func JWTKeyFactory ¶
func NewParser ¶
func NewParser(keyFunc jwt.Keyfunc, method jwt.SigningMethod, newClaims ClaimsFactory) endpoint.Middleware
NewParser creates a new JWT parsing middleware, specifying a jwt.Keyfunc interface, the signing method and the claims type to be used. NewParser adds the resulting claims to endpoint context or returns error on invalid token. Particularly useful for servers.
func RegisteredClaimsFactory ¶
Types ¶
type ClaimsFactory ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
func NewErrorResponse ¶
func NewErrorResponse(err error) ErrorResponse
Click to show internal directories.
Click to hide internal directories.