auth

package
v0.0.0-...-83e654d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessManager

type AccessManager interface {
	IsAllowed(accessType AccessType, userID string, path protocol.Path) bool
}

AccessManager interface allows to provide a custom authentication mechanism

type AccessType

type AccessType int

AccessType permission required by the user

const (
	// READ permission
	READ AccessType = iota

	// WRITE permission
	WRITE
)

type AllowAllAccessManager

type AllowAllAccessManager bool

AllowAllAccessManager is a dummy implementation that grants access for everything.

func NewAllowAllAccessManager

func NewAllowAllAccessManager(allowAll bool) AllowAllAccessManager

NewAllowAllAccessManager returns a new AllowAllAccessManager (depending on the passed parameter, always true or always false)

func (AllowAllAccessManager) IsAllowed

func (am AllowAllAccessManager) IsAllowed(accessType AccessType, userID string, path protocol.Path) bool

IsAllowed returns always the same value, given at construction time (true or false).

type RestAccessManager

type RestAccessManager string

RestAccessManager is a url for which the access is allowed or not.

func NewRestAccessManager

func NewRestAccessManager(url string) RestAccessManager

NewRestAccessManager returns a new RestAccessManager.

func (RestAccessManager) IsAllowed

func (ram RestAccessManager) IsAllowed(accessType AccessType, userId string, path protocol.Path) bool

IsAllowed is an implementation of the AccessManager interface. The boolean result is based on matching between the desired AccessType, the userId and the path.

Jump to

Keyboard shortcuts

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