Documentation
¶
Overview ¶
Package service provides authorization services for the auth module. It includes functionality for checking if a user is authorized to perform specific operations.
Index ¶
- type Config
- type Service
- func (s *Service) GetUserID(ctx context.Context) (string, error)
- func (s *Service) GetUserRoles(ctx context.Context) ([]string, error)
- func (s *Service) HasRole(ctx context.Context, role string) (bool, error)
- func (s *Service) IsAdmin(ctx context.Context) (bool, error)
- func (s *Service) IsAuthorized(ctx context.Context, operation string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// AdminRoleName is the name of the admin role
AdminRoleName string
// ReadOnlyRoleName is the name of the read-only role
ReadOnlyRoleName string
// ReadOperationPrefixes are prefixes for read-only operations
ReadOperationPrefixes []string
}
Config holds the configuration for the authorization service.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for the authorization service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements authorization functionality.
func NewService ¶
NewService creates a new authorization service.
func (*Service) GetUserRoles ¶
GetUserRoles retrieves the user roles from the context.
Click to show internal directories.
Click to hide internal directories.