middleware

package
v0.0.0-...-30e45d9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authentication

func Authentication() martini.Handler

Authentication authenticates user using keystone

func Authorization

func Authorization(action string) martini.Handler

Authorization checks user permissions against policy

func FakeKeystone

func FakeKeystone(martini *martini.ClassicMartini)

FakeKeystone server for only test purpose

func HTTPJSONError

func HTTPJSONError(res http.ResponseWriter, err string, code int)

HTTPJSONError helper for returning JSON errors

func JSONURLs

func JSONURLs() martini.Handler

JSONURLs strips ".json" suffixes added to URLs

func Logging

func Logging() martini.Handler

Logging logs requests and responses

func ReadJSON

func ReadJSON(r *http.Request) (map[string]interface{}, error)

ReadJSON reads JSON from http request

func WithContext

func WithContext() martini.Handler

WithContext injects new empty context object

Types

type Context

type Context map[string]interface{}

Context type

type DefaultNobodyResourceService

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

func (*DefaultNobodyResourceService) VerifyResourcePath

func (nrs *DefaultNobodyResourceService) VerifyResourcePath(resourcePath string) bool

type FakeIdentity

type FakeIdentity struct{}

FakeIdentity middleware

func (*FakeIdentity) GetClient

func (identity *FakeIdentity) GetClient() *gophercloud.ServiceClient

GetClient returns openstack client

func (*FakeIdentity) GetServiceAuthorization

func (identity *FakeIdentity) GetServiceAuthorization() (schema.Authorization, error)

GetServiceAuthorization returns the master authorization with full permission

func (*FakeIdentity) GetTenantID

func (*FakeIdentity) GetTenantID(tenantName string) (string, error)

GetTenantID maps the given tenant name to the tenant's ID

func (*FakeIdentity) GetTenantName

func (*FakeIdentity) GetTenantName(tenantID string) (string, error)

GetTenantName maps the given tenant ID to the tenant's name

func (*FakeIdentity) VerifyToken

func (*FakeIdentity) VerifyToken(tokenID string) (schema.Authorization, error)

VerifyToken fake verify

type IdentityService

type IdentityService interface {
	GetTenantID(string) (string, error)
	GetTenantName(string) (string, error)
	VerifyToken(string) (schema.Authorization, error)
	GetServiceAuthorization() (schema.Authorization, error)
	GetClient() *gophercloud.ServiceClient
}

IdentityService for user authentication & authorization

type NoIdentityService

type NoIdentityService struct {
}

NoIdentityService for disabled auth

func (*NoIdentityService) GetClient

GetClient returns always nil

func (*NoIdentityService) GetServiceAuthorization

func (i *NoIdentityService) GetServiceAuthorization() (schema.Authorization, error)

GetServiceAuthorization returns always authorization for admin

func (*NoIdentityService) GetTenantID

func (i *NoIdentityService) GetTenantID(string) (string, error)

GetTenantID returns always admin

func (*NoIdentityService) GetTenantName

func (i *NoIdentityService) GetTenantName(string) (string, error)

GetTenantName returns always admin

func (*NoIdentityService) VerifyToken

func (i *NoIdentityService) VerifyToken(string) (schema.Authorization, error)

VerifyToken returns always authorization for admin

type NobodyIdentityService

type NobodyIdentityService struct {
}

NobodyIdentityService for nobody auth

func (*NobodyIdentityService) GetClient

GetClient returns always nil

func (*NobodyIdentityService) GetServiceAuthorization

func (i *NobodyIdentityService) GetServiceAuthorization() (schema.Authorization, error)

GetServiceAuthorization returns always authorization for nobody

func (*NobodyIdentityService) GetTenantID

func (i *NobodyIdentityService) GetTenantID(string) (string, error)

GetTenantID returns always nobody

func (*NobodyIdentityService) GetTenantName

func (i *NobodyIdentityService) GetTenantName(string) (string, error)

GetTenantName returns always nobody

func (*NobodyIdentityService) VerifyToken

VerifyToken returns always authorization for nobody

type NobodyResourceService

type NobodyResourceService interface {
	VerifyResourcePath(string) bool
}

NobodyResourceService contains a definition of nobody resources (that do not require authorization)

func NewNobodyResourceService

func NewNobodyResourceService(nobodyResourcePathRegexes []*regexp.Regexp) NobodyResourceService

Jump to

Keyboard shortcuts

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