Documentation ¶
Index ¶
- type Manager
- func (m *Manager) AddRoutes(ctx context.Context, router *mux.Router, ...) http.Handler
- func (m *Manager) AddTokenKey(id string, value []byte)
- func (m *Manager) AddTokenSigningKey(id string, value []byte)
- func (m *Manager) CheckBasicAuth(headerValue string) bool
- func (m *Manager) Context() context.Context
- func (m *Manager) GetToken(id string) (interface{}, bool)
- func (m *Manager) HasToken(id string) bool
- func (m *Manager) IsValidAdminAuthToken(token *api.AdminAuthToken) bool
- func (m *Manager) IsValidAdminAuthTokenRequest(req *http.Request) (*api.AdminAuthToken, bool)
- func (m *Manager) IsValidBasicAuthRequest(req *http.Request) (*api.AdminAuthToken, bool)
- func (m *Manager) Logger() logrus.FieldLogger
- func (m *Manager) NumActive() uint64
- func (m *Manager) PopToken(id string) (interface{}, bool)
- func (m *Manager) RefreshAdminAuthToken(token *api.AdminAuthToken) bool
- func (m *Manager) RefreshToken(id string)
- func (m *Manager) RemoveToken(id string)
- func (m *Manager) SetBasicAuth(allowedValues []string) error
- func (m *Manager) SetToken(id string, token interface{}) error
- func (m *Manager) SignAdminAuthToken(token *api.AdminAuthToken) (string, error)
- func (m *Manager) ValidateAdminAuthTokenString(tokenString string) (*api.AdminAuthToken, error)
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 ¶
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 ¶
AddTokenKey adds the provided key value to the known singing keys of the accociated manager.
func (*Manager) AddTokenSigningKey ¶
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 ¶
CheckBasicAuth checks wether or not the provided header value is valid to be used by the aassociated Manager for basic auth.
func (*Manager) Context ¶
Context Returns the Context of the associated manager.
func (*Manager) GetToken ¶
GetToken returns the token identified by id from the accociated manager.
func (*Manager) HasToken ¶
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 ¶
IsValidAdminAuthTokenRequest checks if the provided request has an Authorization header which is a valid admin auth token at the accociated manager.
func (*Manager) IsValidBasicAuthRequest ¶
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 ¶
NumActive returns the number of the currently active connections at the accociated manager.
func (*Manager) PopToken ¶
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 ¶
RefreshToken updates the timestamp of the token identified by id if that token is know to the accociated manager.
func (*Manager) RemoveToken ¶
RemoveToken removes the token identified by id from the accociated manager.
func (*Manager) SetBasicAuth ¶
SetBasicAuth enables basic auth with the provided values.
func (*Manager) SetToken ¶
SetToken adds a token with the provided id and token value to the accociated manager.