admin

package
v1.2.1-0...-521e7c1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: AGPL-3.0-only Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles admin state.

func NewManager

func NewManager(ctx context.Context, id string, logger logrus.FieldLogger) *Manager

NewManager creates a new Manager with an id.

func (*Manager) AddRoutes

func (m *Manager) AddRoutes(ctx context.Context, router *mux.Router, wrapper func(http.Handler) http.Handler) http.Handler

AddRoutes adds HTTP routes to the provided router, wrapped with the provided wrapper where appropriate.

func (*Manager) AddTokenKey

func (m *Manager) AddTokenKey(id string, value []byte)

AddTokenKey adds the provided key value to the known singing keys of the accociated manager.

func (*Manager) AddTokenSigningKey

func (m *Manager) AddTokenSigningKey(id string, value []byte)

AddTokenSigningKey adds the provided key value to the known signing keys of the accociated manager and sets the id as signing key id.

func (*Manager) CheckBasicAuth

func (m *Manager) CheckBasicAuth(headerValue string) bool

CheckBasicAuth checks wether or not the provided header value is valid to be used by the aassociated Manager for basic auth.

func (*Manager) Context

func (m *Manager) Context() context.Context

Context Returns the Context of the associated manager.

func (*Manager) GetToken

func (m *Manager) GetToken(id string) (interface{}, bool)

GetToken returns the token identified by id from the accociated manager.

func (*Manager) HasToken

func (m *Manager) HasToken(id string) bool

HasToken checks if the provided id is know as token to the accociated manager.

func (*Manager) IsValidAdminAuthToken

func (m *Manager) IsValidAdminAuthToken(token *api.AdminAuthToken) bool

IsValidAdminAuthToken checks if the provided token is known to the accociated manager.

func (*Manager) IsValidAdminAuthTokenRequest

func (m *Manager) IsValidAdminAuthTokenRequest(req *http.Request) (*api.AdminAuthToken, bool)

IsValidAdminAuthTokenRequest checks if the provided request has an Authorization header which is a valid admin auth token at the accociated manager.

func (*Manager) IsValidBasicAuthRequest

func (m *Manager) IsValidBasicAuthRequest(req *http.Request) (*api.AdminAuthToken, bool)

IsValidBasicAuthRequest checks if the provided request has an Authorization header which is a valid basic auth for the accociated manager.

func (*Manager) Logger

func (m *Manager) Logger() logrus.FieldLogger

Logger returns the accociated logger.

func (*Manager) NumActive

func (m *Manager) NumActive() uint64

NumActive returns the number of the currently active connections at the accociated manager.

func (*Manager) PopToken

func (m *Manager) PopToken(id string) (interface{}, bool)

PopToken removes and returns the token identified by id from the accociated manager.

func (*Manager) RefreshAdminAuthToken

func (m *Manager) RefreshAdminAuthToken(token *api.AdminAuthToken) bool

RefreshAdminAuthToken updates the timestamp of the token record of the provided token if known to the accociated manager.

func (*Manager) RefreshToken

func (m *Manager) RefreshToken(id string)

RefreshToken updates the timestamp of the token identified by id if that token is know to the accociated manager.

func (*Manager) RemoveToken

func (m *Manager) RemoveToken(id string)

RemoveToken removes the token identified by id from the accociated manager.

func (*Manager) SetBasicAuth

func (m *Manager) SetBasicAuth(allowedValues []string) error

SetBasicAuth enables basic auth with the provided values.

func (*Manager) SetToken

func (m *Manager) SetToken(id string, token interface{}) error

SetToken adds a token with the provided id and token value to the accociated manager.

func (*Manager) SignAdminAuthToken

func (m *Manager) SignAdminAuthToken(token *api.AdminAuthToken) (string, error)

SignAdminAuthToken signs the provided token and returns its signed string value.

func (*Manager) ValidateAdminAuthTokenString

func (m *Manager) ValidateAdminAuthTokenString(tokenString string) (*api.AdminAuthToken, error)

ValidateAdminAuthTokenString decodes and validates the provided token string value.

Jump to

Keyboard shortcuts

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