security

package
v0.0.0-...-b23ed02 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 6 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL