authorization

package
v0.0.0-...-8aeb8a1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	sync.RWMutex

	//will call after every reloading
	DestinationsForceReload func()
	// contains filtered or unexported fields
}

func NewService

func NewService(configuratorURL, configuratorToken string) (*Service, error)

func (*Service) GetAllIDsByToken

func (s *Service) GetAllIDsByToken(tokenIDentity []string) (ids []string)

GetAllIDsByToken return token ids by token identity(client_secret/server_secret/token id)

func (*Service) GetAllTokenIDs

func (s *Service) GetAllTokenIDs() []string

GetAllTokenIDs return all token ids

func (*Service) GetClientOrigins

func (s *Service) GetClientOrigins(clientSecret string) ([]string, bool)

GetClientOrigins return origins by client_secret

func (*Service) GetServerOrigins

func (s *Service) GetServerOrigins(serverSecret string) ([]string, bool)

GetServerOrigins return origins by server_secret

func (*Service) GetToken

func (s *Service) GetToken(tokenFilter string) *Token

GetToken return token object by client_secret/server_secret/token id

func (*Service) GetTokenID

func (s *Service) GetTokenID(tokenFilter string) string

GetTokenID return token id by client_secret/server_secret/token id return "" if token wasn't found

type Token

type Token struct {
	ID             string   `mapstructure:"id" json:"id,omitempty"`
	ClientSecret   string   `mapstructure:"client_secret" json:"client_secret,omitempty"`
	ServerSecret   string   `mapstructure:"server_secret" json:"server_secret,omitempty"`
	Origins        []string `mapstructure:"origins" json:"origins,omitempty"`
	BatchPeriodMin int      `mapstructure:"batch_period_min" json:"batch_period_min,omitempty"`
}

type TokensHolder

type TokensHolder struct {
	// contains filtered or unexported fields
}

func (*TokensHolder) IsEmpty

func (th *TokensHolder) IsEmpty() bool

type TokensPayload

type TokensPayload struct {
	Tokens []Token `json:"tokens,omitempty"`
}

Jump to

Keyboard shortcuts

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