Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAuthTokenProvided = errors.New("Error: Authorization not provided")
	ErrInvalidAuthToken    = errors.New("Error: Invalid authorization")
)

Functions

func Access

func Access(accessLogger AccessLogger, host string, port uint32) func(http.Handler) *AccessHandler

func NewUaaClient

func NewUaaClient(c *http.Client, address, id, secret string) uaaClient

Types

type AccessHandler

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

func (*AccessHandler) ServeHTTP

func (h *AccessHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type AccessLog

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

func NewAccessLog

func NewAccessLog(req *http.Request, ts time.Time, host string, port uint32) *AccessLog

func (*AccessLog) String

func (al *AccessLog) String() string

type AccessLogger

type AccessLogger interface {
	LogAccess(req *http.Request, host string, port uint32) error
}

type AdminAccessAuthorizer

type AdminAccessAuthorizer func(authToken string) (bool, error)

func NewAdminAccessAuthorizer

func NewAdminAccessAuthorizer(disableAccessControl bool, client UaaClient) AdminAccessAuthorizer

type AuthData

type AuthData struct {
	Scope []string `json:"scope"`
}

func (*AuthData) HasPermission

func (data *AuthData) HasPermission(perm string) bool

type DefaultAccessLogger

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

func NewAccessLogger

func NewAccessLogger(writer io.Writer) *DefaultAccessLogger

func (*DefaultAccessLogger) LogAccess

func (a *DefaultAccessLogger) LogAccess(req *http.Request, host string, port uint32) error

type LogAccessAuthorizer

type LogAccessAuthorizer func(authToken string, appId string) (int, error)

    TODO: We don't need to return an error and a status code. One will suffice.

    func NewLogAccessAuthorizer

    func NewLogAccessAuthorizer(c *http.Client, disableAccessControl bool, apiHost string) LogAccessAuthorizer

    type UaaClient

    type UaaClient interface {
    	GetAuthData(token string) (*AuthData, error)
    }