revocations

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

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

Go to latest
Published: Dec 8, 2015 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 ObserveState

type ObserveState uint64

type ObserverGroup

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

Manage a group of observers (to any kind of resource) An observer is just a channel receiving an ObserverGroupState as notification

func NewObserverGroup

func NewObserverGroup(initialState ObserveState, logger logging.Logger) *ObserverGroup

Create a new observer group Usually there should be only one per resource

func (*ObserverGroup) AddObserver

func (g *ObserverGroup) AddObserver(atState ObserveState) chan ObserveState

Convenient function to add an observer to the group Result is a channel that will receive an empty struct{} on notification

func (*ObserverGroup) AddObserverWithTimeout

func (g *ObserverGroup) AddObserverWithTimeout(atState ObserveState, timeout time.Duration) chan ObserveState

Convenient function to add an observer with timeout to the group Result is a channel that is guaranteed to receive a notification within a given amount of time

func (*ObserverGroup) AttachObserver

func (g *ObserverGroup) AttachObserver(atState ObserveState, observer chan ObserveState)

Attach an observer to the group

func (*ObserverGroup) DetachObserver

func (g *ObserverGroup) DetachObserver(observer chan ObserveState) bool

Detach an observer from the group

func (*ObserverGroup) Notify

func (g *ObserverGroup) Notify(nextState ObserveState)

Notify all observers in the group Each observer will be notified only once, after notification the observer will be removed from the group

type RevocationListVO

type RevocationListVO struct {
	LastVersion uint64          `json:"last_version"`
	Revocations []*RevocationVO `json:"revocations"`
}

func NewRevocationListVO

func NewRevocationListVO(version uint64, revokations []*RevocationVO) *RevocationListVO

type RevocationVO

type RevocationVO struct {
	Version   uint64           `json:"version"`
	Sha256    common.RawSha256 `json:"sha256"`
	ExpiresAt int64            `json:"expires_at"`
}

func NewRevokationVO

func NewRevokationVO(version uint64, sha256 common.RawSha256, expiresAt time.Time) *RevocationVO

type RevocationsManager

type RevocationsManager struct {
	*RevocationsValidator
	// contains filtered or unexported fields
}

Cache/manage revocations Benchmark BenchmarkRevocationsManagerFill-8 1000000 1653 ns/op 234 B/op 7 allocs/op

func NewRevocationsManager

func NewRevocationsManager(store store.ServerStore, parent logging.Logger) (*RevocationsManager, error)

Create a new revocations cache Usually there should only be one

func (*RevocationsManager) AddRevocation

func (r *RevocationsManager) AddRevocation(sha256 common.RawSha256, expiresAt time.Time) error

Add a revocation

func (*RevocationsManager) CurrentVersion

func (r *RevocationsManager) CurrentVersion() uint64

func (*RevocationsManager) GetRevocationsSinceVersion

func (r *RevocationsManager) GetRevocationsSinceVersion(version uint64, maxLength int) *RevocationListVO

Get all revocations since a given version

func (*RevocationsManager) StartCleanup

func (r *RevocationsManager) StartCleanup()

type RevocationsValidator

type RevocationsValidator struct {
	Observe *ObserverGroup
	// contains filtered or unexported fields
}

func NewRevocationsValidator

func NewRevocationsValidator(store store.AgentStore, parent logging.Logger) *RevocationsValidator

func (*RevocationsValidator) IsRevoked

func (r *RevocationsValidator) IsRevoked(sha256 common.RawSha256) bool

Check if a token hash is contained in the revocations I.e. check if the token has been revoked

Jump to

Keyboard shortcuts

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