Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllowedHttp ¶
GetAllowedHttp of the Access.GetAllowedHttp method for use my implementing structures.
Types ¶
type Access ¶
type Access interface {
// GetAllowed returns true if the accessKey is allowed access to the service
// network, otherwise false. If false is returned then the error will
// provide the reason.
GetAllowed(accessKey string) (bool, error)
// Returns true if the request is allowed to access the handler, otherwise
// false. Removes the accessKey parameter from the form to prevent it being
// used by other methods. If false is returned then no further action is
// needed as the method will have responded to the request already.
GetAllowedHttp(w http.ResponseWriter, r *http.Request) bool
}
Access interface for validating entitlement to access the network.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache( size int, refresh func(string, *State) error, onEvicted func(key string, state *State)) (*Cache, error)
NewAccessProxy creates a new access proxy instance.
func (*Cache) GetAllowed ¶
GetAllowed returns true if the accessKey is allowed access to the service network, otherwise false. If false is returned then the error will provide the reason.
func (*Cache) GetAllowedHttp ¶
GetAllowedHttp validates the access key in the request and handles any failures.
type Fixed ¶
type Fixed struct {
// contains filtered or unexported fields
}
Fixed is a implementation of common.Access for testing where a list of provided keys returns true, and all others return false.
func NewFixed ¶
NewFixed creates a new instance of the AccessFixed structure with the fixed list of keys provided the allowed keys.
func (*Fixed) GetAllowed ¶
GetAllowed validates access key is allowed.
func (*Fixed) GetAllowedHttp ¶
GetAllowedHttp validates the access key in the request and handles any failures.