Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService struct { Config *config.ConfigurationRepo DB *gorm.DB }
AuthService is an Authorization Service for storing, retrieving and verifying authorization keys
func NewAuthService ¶
func NewAuthService(config *config.ConfigurationRepo, db *gorm.DB) *AuthService
NewAuthService returns a new initialized Authorization Service
func (*AuthService) AuthorizeAPIKey ¶
func (s *AuthService) AuthorizeAPIKey(key string) error
AuthorizeAPIKey returns an error if key is disabled, doesnt exist or is expired
func (*AuthService) CreateAPIKey ¶
func (s *AuthService) CreateAPIKey(expirationDate *time.Time) (string, error)
CreateAPIKey creates a new key in the db and returns the key
func (*AuthService) DisableAPIKey ¶
func (s *AuthService) DisableAPIKey(keyID string) error
DisableAPIKey disables a given keyID so it can no longer be used
func (*AuthService) ListAPIKeys ¶
func (s *AuthService) ListAPIKeys() []string
ListAPIKeys returns a list of currently enabled API Keys
Click to show internal directories.
Click to hide internal directories.