Documentation
¶
Overview ¶
Package token implements the Internal Token Service.
Responsibilities:
- CRUD for RouterTokens
- Validation of incoming bearer tokens against stored hashes
- Enforcement of TokenRules
Index ¶
- type CreateOptions
- type Service
- func (s *Service) Create(opts CreateOptions) (*models.RouterToken, error)
- func (s *Service) Delete(id string) error
- func (s *Service) Get(id string) (*models.RouterToken, error)
- func (s *Service) List() ([]*models.RouterToken, error)
- func (s *Service) Regenerate(id string) (*models.RouterToken, error)
- func (s *Service) UpdateRules(id string, rules models.TokenRules) error
- func (s *Service) Validate(raw string) (*models.RouterToken, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
Name string
Rules models.TokenRules
}
CreateOptions holds the parameters for issuing a new token.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages router-tokens.
func (*Service) Create ¶
func (s *Service) Create(opts CreateOptions) (*models.RouterToken, error)
Create mints a new RouterToken and persists it. The raw (unhashed) token value is returned exactly once — it is not stored.
func (*Service) Get ¶
func (s *Service) Get(id string) (*models.RouterToken, error)
Get returns a RouterToken by ID.
func (*Service) List ¶
func (s *Service) List() ([]*models.RouterToken, error)
List returns all RouterTokens.
func (*Service) Regenerate ¶
func (s *Service) Regenerate(id string) (*models.RouterToken, error)
Regenerate replaces the secret of an existing token with a new one. The token keeps its ID, Name and Rules; the old secret is invalidated.
func (*Service) UpdateRules ¶
func (s *Service) UpdateRules(id string, rules models.TokenRules) error
UpdateRules replaces the TokenRules for an existing token.
Click to show internal directories.
Click to hide internal directories.