Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface {
Verify(ctx context.Context, m proto.Message, auth *commonpb.Auth) error
}
Authenticator authenticates a message with the provided auth.
It is not usually sufficient to rely purely on authentication for permissions, as a lookup must be completed. However, if a message is not authentic, we can short circuit authorization.
In general, users should use an Authorizer, and Authorizer's should use an Authenticator.
func NewKeyPairAuthenticator ¶
func NewKeyPairAuthenticator() Authenticator
NewKeyPairAuthenticator authenticates pub key based auth.
type Authorizer ¶
type Authorizer interface {
Authorize(ctx context.Context, m proto.Message, authField **commonpb.Auth) (*commonpb.UserId, error)
}
Authorizer authorizes an action for a UserId with the given auth.
If the auth is authorized, it is also authenticated. Authorization is more expensive than authentication as lookups must be performed.
type Messaging ¶
type Messaging interface { CanStreamMessages(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, string, error) CanGetMessage(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, string, error) CanGetMessages(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, string, error) CanSendMessage(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId, content *messagingpb.Content, paymentIntent *commonpb.IntentId) (bool, string, error) CanAdvancePointer(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, string, error) CanNotifyIsTyping(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, string, error) }
type StaticAuthorizer ¶
type StaticAuthorizer struct {
// contains filtered or unexported fields
}
func NewStaticAuthorizer ¶
func NewStaticAuthorizer() *StaticAuthorizer
Click to show internal directories.
Click to hide internal directories.