Documentation
¶
Overview ¶
Package auth is a generated GoMock package.
Index ¶
- func AddClaimHandler(next http.Handler, vehicleAddr, mfrAddr common.Address) http.Handler
- func AllOfPrivilegeCheck(ctx context.Context, _ any, next graphql.Resolver, requiredPrivs []string) (any, error)
- func ErrorHandler(w http.ResponseWriter, r *http.Request, err error)
- func GetValidatedClaims(ctx context.Context) (*validator.ValidatedClaims, bool)
- func NewJWTMiddleware(issuer, jwksURI string) (*jwtmiddleware.JWTMiddleware, error)
- func NewManufacturerTokenCheck(requiredAddr common.Address, identitySvc IdentityService) func(context.Context, any, graphql.Resolver) (any, error)
- func NewVehicleTokenCheck(requiredAddr common.Address) func(context.Context, any, graphql.Resolver) (any, error)
- func OneOfPrivilegeCheck(ctx context.Context, _ any, next graphql.Resolver, requiredPrivs []string) (any, error)
- func ValidRequest(ctx context.Context, subject string, filter *model.AttestationFilter) bool
- type IdentityService
- type MockIdentityService
- type MockIdentityServiceMockRecorder
- type TelemetryClaim
- type TelemetryClaimContextKey
- type TokenValidator
- type UnauthorizedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddClaimHandler ¶
AddClaimHandler is a middleware that fills in GraphQL-friendly privilege information on the *TelemetryClaim object in the context.
func AllOfPrivilegeCheck ¶ added in v0.0.30
func AllOfPrivilegeCheck(ctx context.Context, _ any, next graphql.Resolver, requiredPrivs []string) (any, error)
AllOfPrivilegeCheck checks if the claim set in the context includes the required privileges.
func ErrorHandler ¶
func ErrorHandler(w http.ResponseWriter, r *http.Request, err error)
ErrorHandler is a custom error handler for the jwt middleware. It logs the error and then calls the default error handler.
func GetValidatedClaims ¶ added in v0.1.13
func GetValidatedClaims(ctx context.Context) (*validator.ValidatedClaims, bool)
GetValidatedClaims returns the validated claims from the request context.
func NewJWTMiddleware ¶
func NewJWTMiddleware(issuer, jwksURI string) (*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.
func NewManufacturerTokenCheck ¶ added in v0.0.23
func NewVehicleTokenCheck ¶ added in v0.0.23
func OneOfPrivilegeCheck ¶ added in v0.0.30
func OneOfPrivilegeCheck(ctx context.Context, _ any, next graphql.Resolver, requiredPrivs []string) (any, error)
OneOfPrivilegeCheck checks if the claim set in the context includes at least one of the required privileges.
func ValidRequest ¶ added in v0.1.17
Types ¶
type IdentityService ¶ added in v0.0.23
type MockIdentityService ¶ added in v0.0.23
type MockIdentityService struct {
// contains filtered or unexported fields
}
MockIdentityService is a mock of IdentityService interface.
func NewMockIdentityService ¶ added in v0.0.23
func NewMockIdentityService(ctrl *gomock.Controller) *MockIdentityService
NewMockIdentityService creates a new mock instance.
func (*MockIdentityService) EXPECT ¶ added in v0.0.23
func (m *MockIdentityService) EXPECT() *MockIdentityServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockIdentityService) GetAftermarketDevice ¶ added in v0.0.23
func (m *MockIdentityService) GetAftermarketDevice(ctx context.Context, address *common.Address, tokenID *int, serial *string) (*identity.DeviceInfos, error)
GetAftermarketDevice mocks base method.
type MockIdentityServiceMockRecorder ¶ added in v0.0.23
type MockIdentityServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockIdentityServiceMockRecorder is the mock recorder for MockIdentityService.
func (*MockIdentityServiceMockRecorder) GetAftermarketDevice ¶ added in v0.0.23
func (mr *MockIdentityServiceMockRecorder) GetAftermarketDevice(ctx, address, tokenID, serial any) *gomock.Call
GetAftermarketDevice indicates an expected call of GetAftermarketDevice.
type TelemetryClaim ¶
type TelemetryClaim struct {
AssetDID cloudevent.ERC721DID
tokenclaims.CustomClaims
}
TelemetryClaim is a custom claim for the telemetry API.
type TelemetryClaimContextKey ¶
type TelemetryClaimContextKey struct{}
TelemetryClaimContextKey is a custom key for the context to store the custom claims.
type TokenValidator ¶ added in v0.0.23
type TokenValidator struct {
IdentitySvc IdentityService
}
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