middleware

package
v0.0.0-...-3f89d33 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 13 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 FakeIdentity

type FakeIdentity struct{}

FakeIdentity middleware

func (*FakeIdentity) GetServiceAuthorization

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

GetServiceAuthorization returns the master authorization with full permisions

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)
}

IdentityService for user authentication & authorization

Jump to

Keyboard shortcuts

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