Documentation
¶
Index ¶
- func AddClaimHandler(next http.Handler, logger *zerolog.Logger, vehicleAddr, mfrAddr string) http.Handler
- func CreateVehicleTokenCheck(contractAddr string) func(context.Context, any, graphql.Resolver) (any, error)
- func ErrorHandler(logger *zerolog.Logger) func(w http.ResponseWriter, r *http.Request, err error)
- func NewJWTMiddleware(issuer, jwksURI string, logger *zerolog.Logger) (*jwtmiddleware.JWTMiddleware, error)
- func PrivilegeCheck(ctx context.Context, _ any, next graphql.Resolver, privs []model.Privilege) (any, error)
- type TelemetryClaim
- type TelemetryClaimContextKey
- type UnauthorizedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddClaimHandler ¶
func AddClaimHandler(next http.Handler, logger *zerolog.Logger, vehicleAddr, mfrAddr string) http.Handler
AddClaimHandler is a middleware that fills in GraphQL-friendly privilege information on the *TelemetryClaim object in the context.
func CreateVehicleTokenCheck ¶ added in v0.0.21
func ErrorHandler ¶
ErrorHandler is a custom error handler for the jwt middleware. It logs the error and then calls the default error handler.
func NewJWTMiddleware ¶
func NewJWTMiddleware(issuer, jwksURI string, logger *zerolog.Logger) (*jwtmiddleware.JWTMiddleware, error)
NewJWTMiddleware creates a new JWT middleware with the given issuer and contract address. This middleware will validate the token and add the claim to the context.
Types ¶
type TelemetryClaim ¶
type TelemetryClaim struct { privilegetoken.CustomClaims // contains filtered or unexported fields }
TelemetryClaim is a custom claim for the telemetry API.
func (*TelemetryClaim) SetPrivileges ¶
func (t *TelemetryClaim) SetPrivileges(contractPrivMaps map[common.Address]map[privileges.Privilege]model.Privilege)
SetPrivileges populates the set of GraphQL privileges on the claim object. To do this, it combines the address and privilege ids on the token together with the given map.
type TelemetryClaimContextKey ¶
type TelemetryClaimContextKey struct{}
TelemetryClaimContextKey is a custom key for the context to store the custom claims.
type UnauthorizedError ¶ added in v0.0.21
type UnauthorizedError struct {
// contains filtered or unexported fields
}
func (UnauthorizedError) Error ¶ added in v0.0.21
func (e UnauthorizedError) Error() string
func (UnauthorizedError) Unwrap ¶ added in v0.0.21
func (e UnauthorizedError) Unwrap() error