Documentation ¶
Overview ¶
Package auth is a generated GoMock package.
Index ¶
- Variables
- func NewAuth(authn AuthnInterface, authz AuthzInterface) *auth
- func NewAuthn(setter TemporarySecretSetter) (*authnImpl, error)
- func NewAuthz(db *gorm.DB, redisOpts *genericoptions.RedisOptions, logger clog.Logger) (*authzImpl, error)
- func NewLogger(kafkaOpts *genericoptions.KafkaOptions) (*kafkaLogger, error)
- type AuditMessage
- type AuthProvider
- type AuthnInterface
- type AuthzInterface
- type MockAuthProvider
- type MockAuthProviderMockRecorder
- type MockAuthnInterface
- type MockAuthnInterfaceMockRecorder
- type MockAuthzInterface
- type MockAuthzInterfaceMockRecorder
- type TemporarySecretSetter
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingKID is returned when the token format is invalid and the kid field is missing in the token header. ErrMissingKID = errors.Unauthorized(reasonUnauthorized, "Invalid token format: missing kid field in header") // ErrSecretDisabled is returned when the SecretID is disabled. ErrSecretDisabled = errors.Unauthorized(reasonUnauthorized, "SecretID is disabled") )
var AuthnProviderSet = wire.NewSet(NewAuthn, wire.Bind(new(AuthnInterface), new(*authnImpl)))
AuthnProviderSet is authn providers.
var AuthzProviderSet = wire.NewSet(NewAuthz, wire.Bind(new(AuthzInterface), new(*authzImpl)), LoggerProviderSet)
AuthzProviderSet defines a wire set for authorization.
var LoggerProviderSet = wire.NewSet(NewLogger, wire.Bind(new(clog.Logger), new(*kafkaLogger)))
LoggerProviderSet defines a wire set for creating a kafkaLogger instance to implement log.Logger interface.
var ProviderSet = wire.NewSet(NewAuth, wire.Bind(new(AuthProvider), new(*auth)), AuthnProviderSet, AuthzProviderSet)
ProviderSet is a Wire provider set that creates a new instance of auth.
Functions ¶
func NewAuth ¶
func NewAuth(authn AuthnInterface, authz AuthzInterface) *auth
NewAuth is a constructor function that creates a new instance of auth struct.
func NewAuthn ¶
func NewAuthn(setter TemporarySecretSetter) (*authnImpl, error)
NewAuthn returns a new instance of authn.
func NewAuthz ¶
func NewAuthz(db *gorm.DB, redisOpts *genericoptions.RedisOptions, logger clog.Logger) (*authzImpl, error)
NewAuthz creates a new authorization instance using the provided database, Redis options, and logger.
func NewLogger ¶
func NewLogger(kafkaOpts *genericoptions.KafkaOptions) (*kafkaLogger, error)
NewLogger creates a new kafkaLogger instance.
Types ¶
type AuditMessage ¶
type AuditMessage struct { Matcher string `protobuf:"bytes,1,opt,name=matcher,proto3" json:"matcher,omitempty"` Request []interface{} `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` Result bool `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` Explains [][]string `protobuf:"bytes,4,opt,name=explains,proto3" json:"explains,omitempty"` Timestamp int64 `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` }
AuditMessage is the message structure for log messages.
type AuthProvider ¶
type AuthProvider interface { AuthnInterface AuthzInterface }
AuthProvider is an interface that combines both the AuthnInterface and AuthzInterface interfaces.
type AuthnInterface ¶
type AuthnInterface interface { // Sign is used to generate a access token. userID is the jwt identity key. Sign(ctx context.Context, userID string) (authn.IToken, error) // Verify is used to verify a access token. If the verification // is successful, userID will be returned. Verify(accessToken string) (string, error) }
AuthnInterface defines the interface for authentication.
type AuthzInterface ¶
AuthzInterface defines the interface for authorization.
type MockAuthProvider ¶
type MockAuthProvider struct {
// contains filtered or unexported fields
}
MockAuthProvider is a mock of AuthProvider interface.
func NewMockAuthProvider ¶
func NewMockAuthProvider(ctrl *gomock.Controller) *MockAuthProvider
NewMockAuthProvider creates a new mock instance.
func (*MockAuthProvider) Authorize ¶
func (m *MockAuthProvider) Authorize(arg0 ...interface{}) (bool, error)
Authorize mocks base method.
func (*MockAuthProvider) EXPECT ¶
func (m *MockAuthProvider) EXPECT() *MockAuthProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAuthProviderMockRecorder ¶
type MockAuthProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthProviderMockRecorder is the mock recorder for MockAuthProvider.
func (*MockAuthProviderMockRecorder) Authorize ¶
func (mr *MockAuthProviderMockRecorder) Authorize(arg0 ...interface{}) *gomock.Call
Authorize indicates an expected call of Authorize.
func (*MockAuthProviderMockRecorder) Sign ¶
func (mr *MockAuthProviderMockRecorder) Sign(arg0, arg1 interface{}) *gomock.Call
Sign indicates an expected call of Sign.
func (*MockAuthProviderMockRecorder) Verify ¶
func (mr *MockAuthProviderMockRecorder) Verify(arg0 interface{}) *gomock.Call
Verify indicates an expected call of Verify.
type MockAuthnInterface ¶
type MockAuthnInterface struct {
// contains filtered or unexported fields
}
MockAuthnInterface is a mock of AuthnInterface interface.
func NewMockAuthnInterface ¶
func NewMockAuthnInterface(ctrl *gomock.Controller) *MockAuthnInterface
NewMockAuthnInterface creates a new mock instance.
func (*MockAuthnInterface) EXPECT ¶
func (m *MockAuthnInterface) EXPECT() *MockAuthnInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAuthnInterfaceMockRecorder ¶
type MockAuthnInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthnInterfaceMockRecorder is the mock recorder for MockAuthnInterface.
func (*MockAuthnInterfaceMockRecorder) Sign ¶
func (mr *MockAuthnInterfaceMockRecorder) Sign(arg0, arg1 interface{}) *gomock.Call
Sign indicates an expected call of Sign.
func (*MockAuthnInterfaceMockRecorder) Verify ¶
func (mr *MockAuthnInterfaceMockRecorder) Verify(arg0 interface{}) *gomock.Call
Verify indicates an expected call of Verify.
type MockAuthzInterface ¶
type MockAuthzInterface struct {
// contains filtered or unexported fields
}
MockAuthzInterface is a mock of AuthzInterface interface.
func NewMockAuthzInterface ¶
func NewMockAuthzInterface(ctrl *gomock.Controller) *MockAuthzInterface
NewMockAuthzInterface creates a new mock instance.
func (*MockAuthzInterface) Authorize ¶
func (m *MockAuthzInterface) Authorize(arg0 ...interface{}) (bool, error)
Authorize mocks base method.
func (*MockAuthzInterface) EXPECT ¶
func (m *MockAuthzInterface) EXPECT() *MockAuthzInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAuthzInterfaceMockRecorder ¶
type MockAuthzInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthzInterfaceMockRecorder is the mock recorder for MockAuthzInterface.
func (*MockAuthzInterfaceMockRecorder) Authorize ¶
func (mr *MockAuthzInterfaceMockRecorder) Authorize(arg0 ...interface{}) *gomock.Call
Authorize indicates an expected call of Authorize.