Documentation ¶
Index ¶
- Constants
- Variables
- type Backend
- type Client
- func (client *Client) AddBackend(key string, backend Backend)
- func (client *Client) Auth(handler http.Handler) http.Handler
- func (client *Client) AuthRequired(handler http.Handler) http.Handler
- func (client *Client) GetBackend(key string) Backend
- func (client *Client) GetRepository() Repository
- func (client *Client) GetToken(authorizationHeader string) (string, string)
- func (client *Client) GetUserFromContext(ctx context.Context) IAuthenticationBackendUser
- func (client *Client) Login(ctx context.Context, r *http.Request) (int, IAuthenticationBackendUser)
- func (client *Client) RemoveBackend(key string) Backend
- func (client *Client) SetUserToContext(ctx context.Context, user IAuthenticationBackendUser) context.Context
- func (client *Client) Stop()
- type Config
- type GetSecretResponseV1
- func (*GetSecretResponseV1) Descriptor() ([]byte, []int)deprecated
- func (x *GetSecretResponseV1) GetData() *SecretResponse
- func (*GetSecretResponseV1) ProtoMessage()
- func (x *GetSecretResponseV1) ProtoReflect() protoreflect.Message
- func (x *GetSecretResponseV1) Reset()
- func (x *GetSecretResponseV1) String() string
- type IAuthenticationBackendUser
- type JWTBackend
- func (backend JWTBackend) DecodeAccessToken(_ context.Context, tokenValue string, secret uuid.UUID) (int, *JWTUser)
- func (backend JWTBackend) DecodeAccessTokenWithoutValidation(_ context.Context, tokenValue string) (int, *JWTUser)
- func (backend JWTBackend) GetUser(ctx context.Context, token string) (int, IAuthenticationBackendUser)
- type JWTUser
- type Repository
- type Secret
- type SecretCreatedV1
- func (*SecretCreatedV1) Descriptor() ([]byte, []int)deprecated
- func (x *SecretCreatedV1) GetCreated() int64
- func (x *SecretCreatedV1) GetId() []byte
- func (x *SecretCreatedV1) GetValue() []byte
- func (*SecretCreatedV1) ProtoMessage()
- func (x *SecretCreatedV1) ProtoReflect() protoreflect.Message
- func (x *SecretCreatedV1) Reset()
- func (x *SecretCreatedV1) String() string
- type SecretResponse
- func (*SecretResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SecretResponse) GetCreated() int64
- func (x *SecretResponse) GetId() []byte
- func (x *SecretResponse) GetValue() []byte
- func (*SecretResponse) ProtoMessage()
- func (x *SecretResponse) ProtoReflect() protoreflect.Message
- func (x *SecretResponse) Reset()
- func (x *SecretResponse) String() string
- type SecretsRepository
- type Subscription
Constants ¶
View Source
const ( Ok = iota BackendNotFound IncorrectToken InvalidToken SecretNotFound )
Variables ¶
View Source
var File_inout_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
GetUser(ctx context.Context, token string) (int, IAuthenticationBackendUser)
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func InitHiveClient ¶
func (*Client) AddBackend ¶
func (*Client) GetBackend ¶
func (*Client) GetRepository ¶
func (client *Client) GetRepository() Repository
func (*Client) GetUserFromContext ¶
func (client *Client) GetUserFromContext(ctx context.Context) IAuthenticationBackendUser
func (*Client) RemoveBackend ¶
func (*Client) SetUserToContext ¶
type GetSecretResponseV1 ¶
type GetSecretResponseV1 struct { Data *SecretResponse `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*GetSecretResponseV1) Descriptor
deprecated
func (*GetSecretResponseV1) Descriptor() ([]byte, []int)
Deprecated: Use GetSecretResponseV1.ProtoReflect.Descriptor instead.
func (*GetSecretResponseV1) GetData ¶
func (x *GetSecretResponseV1) GetData() *SecretResponse
func (*GetSecretResponseV1) ProtoMessage ¶
func (*GetSecretResponseV1) ProtoMessage()
func (*GetSecretResponseV1) ProtoReflect ¶
func (x *GetSecretResponseV1) ProtoReflect() protoreflect.Message
func (*GetSecretResponseV1) Reset ¶
func (x *GetSecretResponseV1) Reset()
func (*GetSecretResponseV1) String ¶
func (x *GetSecretResponseV1) String() string
type JWTBackend ¶
type JWTBackend struct {
// contains filtered or unexported fields
}
func InitJWTBackend ¶
func InitJWTBackend(repository *Repository) *JWTBackend
func (JWTBackend) DecodeAccessToken ¶
func (JWTBackend) DecodeAccessTokenWithoutValidation ¶
func (JWTBackend) GetUser ¶
func (backend JWTBackend) GetUser(ctx context.Context, token string) (int, IAuthenticationBackendUser)
type JWTUser ¶
type JWTUser struct { jwt.StandardClaims IsAdmin bool `json:"isAdmin"` Roles []string `json:"roles"` UserID uuid.UUID `json:"userID"` SecretID uuid.UUID `json:"secretID"` }
func (JWTUser) GetIsAdmin ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func InitRepository ¶
func InitRepository(hiveAPI string) *Repository
func (Repository) SetSecret ¶
func (repository Repository) SetSecret(secret *Secret)
type SecretCreatedV1 ¶
type SecretCreatedV1 struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Created int64 `protobuf:"varint,2,opt,name=created,proto3" json:"created,omitempty"` Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*SecretCreatedV1) Descriptor
deprecated
func (*SecretCreatedV1) Descriptor() ([]byte, []int)
Deprecated: Use SecretCreatedV1.ProtoReflect.Descriptor instead.
func (*SecretCreatedV1) GetCreated ¶
func (x *SecretCreatedV1) GetCreated() int64
func (*SecretCreatedV1) GetId ¶
func (x *SecretCreatedV1) GetId() []byte
func (*SecretCreatedV1) GetValue ¶
func (x *SecretCreatedV1) GetValue() []byte
func (*SecretCreatedV1) ProtoMessage ¶
func (*SecretCreatedV1) ProtoMessage()
func (*SecretCreatedV1) ProtoReflect ¶
func (x *SecretCreatedV1) ProtoReflect() protoreflect.Message
func (*SecretCreatedV1) Reset ¶
func (x *SecretCreatedV1) Reset()
func (*SecretCreatedV1) String ¶
func (x *SecretCreatedV1) String() string
type SecretResponse ¶
type SecretResponse struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Created int64 `protobuf:"varint,2,opt,name=created,proto3" json:"created,omitempty"` Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*SecretResponse) Descriptor
deprecated
func (*SecretResponse) Descriptor() ([]byte, []int)
Deprecated: Use SecretResponse.ProtoReflect.Descriptor instead.
func (*SecretResponse) GetCreated ¶
func (x *SecretResponse) GetCreated() int64
func (*SecretResponse) GetId ¶
func (x *SecretResponse) GetId() []byte
func (*SecretResponse) GetValue ¶
func (x *SecretResponse) GetValue() []byte
func (*SecretResponse) ProtoMessage ¶
func (*SecretResponse) ProtoMessage()
func (*SecretResponse) ProtoReflect ¶
func (x *SecretResponse) ProtoReflect() protoreflect.Message
func (*SecretResponse) Reset ¶
func (x *SecretResponse) Reset()
func (*SecretResponse) String ¶
func (x *SecretResponse) String() string
type SecretsRepository ¶
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func InitHiveSubscription ¶
func InitHiveSubscription(serviceName string, topic string, nsqLookupAddress string, repository *Repository) *Subscription
func (*Subscription) HandleMessage ¶
func (subscription *Subscription) HandleMessage(message *nsq.Message) error
func (*Subscription) Stop ¶
func (subscription *Subscription) Stop()
Click to show internal directories.
Click to hide internal directories.