Documentation
¶
Index ¶
- Variables
- type Authorizer
- type Server
- func (s *Server) GetUnauthenticatedUserFlags(ctx context.Context, req *accountpb.GetUnauthenticatedUserFlagsRequest) (*accountpb.GetUnauthenticatedUserFlagsResponse, error)
- func (s *Server) GetUserFlags(ctx context.Context, req *accountpb.GetUserFlagsRequest) (*accountpb.GetUserFlagsResponse, error)
- func (s *Server) Login(ctx context.Context, req *accountpb.LoginRequest) (*accountpb.LoginResponse, error)
- func (s *Server) Register(ctx context.Context, req *accountpb.RegisterRequest) (*accountpb.RegisterResponse, error)
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrManyPublicKeys = errors.New("detected multiple keys for user") )
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
func NewAuthorizer ¶
func NewAuthorizer(log *zap.Logger, store Store, authn auth.Authenticator) *Authorizer
type Server ¶
type Server struct {
accountpb.UnimplementedAccountServer
// contains filtered or unexported fields
}
func (*Server) GetUnauthenticatedUserFlags ¶
func (s *Server) GetUnauthenticatedUserFlags(ctx context.Context, req *accountpb.GetUnauthenticatedUserFlagsRequest) (*accountpb.GetUnauthenticatedUserFlagsResponse, error)
func (*Server) GetUserFlags ¶
func (s *Server) GetUserFlags(ctx context.Context, req *accountpb.GetUserFlagsRequest) (*accountpb.GetUserFlagsResponse, error)
func (*Server) Login ¶
func (s *Server) Login(ctx context.Context, req *accountpb.LoginRequest) (*accountpb.LoginResponse, error)
func (*Server) Register ¶
func (s *Server) Register(ctx context.Context, req *accountpb.RegisterRequest) (*accountpb.RegisterResponse, error)
type Store ¶
type Store interface {
// Bind binds a public key to a UserId, or returns the previously bound UserId.
Bind(ctx context.Context, userID *commonpb.UserId, pubKey *commonpb.PublicKey) (*commonpb.UserId, error)
// GetUserId returns the UserId associated with a public key.
//
/// ErrNotFound is returned if no binding exists.
GetUserId(ctx context.Context, pubKey *commonpb.PublicKey) (*commonpb.UserId, error)
// GetPubKeys returns the set of public keys associated with an account.
GetPubKeys(ctx context.Context, userID *commonpb.UserId) ([]*commonpb.PublicKey, error)
// IsAuthorized returns whether or not a pubKey is authorized to perform actions on behalf of the user.
IsAuthorized(ctx context.Context, userID *commonpb.UserId, pubKey *commonpb.PublicKey) (bool, error)
// IsStaff returns whether or not a userID is a staff user
IsStaff(ctx context.Context, userID *commonpb.UserId) (bool, error)
// IsRegistered returns whether or not a userID is a registered account
IsRegistered(ctx context.Context, userID *commonpb.UserId) (bool, error)
// SetRegistrationFlag sets wether a userID is a registered account
SetRegistrationFlag(ctx context.Context, userID *commonpb.UserId, isRegistered bool) error
}
Click to show internal directories.
Click to hide internal directories.