Documentation
¶
Overview ¶
Package mock_middleware is a generated GoMock package.
Index ¶
- func Authentication() martini.Handler
- func Authorization(action string) martini.Handler
- func FakeKeystone(martini *martini.ClassicMartini)
- func HTTPJSONError(res http.ResponseWriter, err string, code int)
- func JSONURLs() martini.Handler
- func Logging() martini.Handler
- func Metrics() martini.Handler
- func ReadJSON(r *http.Request) (map[string]interface{}, error)
- func WithContext() martini.Handler
- type CachedIdentityService
- func (c *CachedIdentityService) GetClient() *gophercloud.ServiceClient
- func (c *CachedIdentityService) GetServiceAuthorization() (schema.Authorization, error)
- func (c *CachedIdentityService) GetTenantID(tenantName string) (string, error)
- func (c *CachedIdentityService) GetTenantName(tenantID string) (string, error)
- func (c *CachedIdentityService) VerifyToken(token string) (schema.Authorization, error)
- type Context
- type DefaultNobodyResourceService
- type FakeIdentity
- func (identity *FakeIdentity) GetClient() *gophercloud.ServiceClient
- func (identity *FakeIdentity) GetServiceAuthorization() (schema.Authorization, error)
- func (*FakeIdentity) GetTenantID(tenantName string) (string, error)
- func (*FakeIdentity) GetTenantName(tenantID string) (string, error)
- func (*FakeIdentity) VerifyToken(tokenID string) (schema.Authorization, error)
- type IdentityService
- type MockIdentityService
- func (m *MockIdentityService) EXPECT() *MockIdentityServiceMockRecorder
- func (m *MockIdentityService) GetClient() *gophercloud.ServiceClient
- func (m *MockIdentityService) GetServiceAuthorization() (schema.Authorization, error)
- func (m *MockIdentityService) GetTenantID(arg0 string) (string, error)
- func (m *MockIdentityService) GetTenantName(arg0 string) (string, error)
- func (m *MockIdentityService) VerifyToken(arg0 string) (schema.Authorization, error)
- type MockIdentityServiceMockRecorder
- func (mr *MockIdentityServiceMockRecorder) GetClient() *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) GetServiceAuthorization() *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) GetTenantID(arg0 interface{}) *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) GetTenantName(arg0 interface{}) *gomock.Call
- func (mr *MockIdentityServiceMockRecorder) VerifyToken(arg0 interface{}) *gomock.Call
- type MockNobodyResourceService
- type MockNobodyResourceServiceMockRecorder
- type NoIdentityService
- func (i *NoIdentityService) GetClient() *gophercloud.ServiceClient
- func (i *NoIdentityService) GetServiceAuthorization() (schema.Authorization, error)
- func (i *NoIdentityService) GetTenantID(string) (string, error)
- func (i *NoIdentityService) GetTenantName(string) (string, error)
- func (i *NoIdentityService) VerifyToken(string) (schema.Authorization, error)
- type NobodyIdentityService
- func (i *NobodyIdentityService) GetClient() *gophercloud.ServiceClient
- func (i *NobodyIdentityService) GetServiceAuthorization() (schema.Authorization, error)
- func (i *NobodyIdentityService) GetTenantID(string) (string, error)
- func (i *NobodyIdentityService) GetTenantName(string) (string, error)
- func (i *NobodyIdentityService) VerifyToken(string) (schema.Authorization, error)
- type NobodyResourceService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authentication ¶
Authentication authenticates user using keystone
func Authorization ¶
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
Types ¶
type CachedIdentityService ¶
type CachedIdentityService struct {
// contains filtered or unexported fields
}
func (*CachedIdentityService) GetClient ¶
func (c *CachedIdentityService) GetClient() *gophercloud.ServiceClient
func (*CachedIdentityService) GetServiceAuthorization ¶
func (c *CachedIdentityService) GetServiceAuthorization() (schema.Authorization, error)
func (*CachedIdentityService) GetTenantID ¶
func (c *CachedIdentityService) GetTenantID(tenantName string) (string, error)
func (*CachedIdentityService) GetTenantName ¶
func (c *CachedIdentityService) GetTenantName(tenantID string) (string, error)
func (*CachedIdentityService) VerifyToken ¶
func (c *CachedIdentityService) VerifyToken(token string) (schema.Authorization, error)
type DefaultNobodyResourceService ¶
type DefaultNobodyResourceService struct {
// contains filtered or unexported fields
}
DefaultNobodyResourceService contains a definition of default nobody resources
func (*DefaultNobodyResourceService) VerifyResourcePath ¶
func (nrs *DefaultNobodyResourceService) VerifyResourcePath(resourcePath string) bool
VerifyResourcePath verifies resource path
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
func CreateIdentityServiceFromConfig ¶
func CreateIdentityServiceFromConfig(config *util.Config) (IdentityService, error)
CreateIdentityServiceFromConfig creates keystone identity from config
func NewCachedIdentityService ¶
func NewCachedIdentityService(inner IdentityService, ttl time.Duration) IdentityService
type MockIdentityService ¶
type MockIdentityService struct {
// contains filtered or unexported fields
}
MockIdentityService is a mock of IdentityService interface
func NewMockIdentityService ¶
func NewMockIdentityService(ctrl *gomock.Controller) *MockIdentityService
NewMockIdentityService creates a new mock instance
func (*MockIdentityService) EXPECT ¶
func (m *MockIdentityService) EXPECT() *MockIdentityServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockIdentityService) GetClient ¶
func (m *MockIdentityService) GetClient() *gophercloud.ServiceClient
GetClient mocks base method
func (*MockIdentityService) GetServiceAuthorization ¶
func (m *MockIdentityService) GetServiceAuthorization() (schema.Authorization, error)
GetServiceAuthorization mocks base method
func (*MockIdentityService) GetTenantID ¶
func (m *MockIdentityService) GetTenantID(arg0 string) (string, error)
GetTenantID mocks base method
func (*MockIdentityService) GetTenantName ¶
func (m *MockIdentityService) GetTenantName(arg0 string) (string, error)
GetTenantName mocks base method
func (*MockIdentityService) VerifyToken ¶
func (m *MockIdentityService) VerifyToken(arg0 string) (schema.Authorization, error)
VerifyToken mocks base method
type MockIdentityServiceMockRecorder ¶
type MockIdentityServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockIdentityServiceMockRecorder is the mock recorder for MockIdentityService
func (*MockIdentityServiceMockRecorder) GetClient ¶
func (mr *MockIdentityServiceMockRecorder) GetClient() *gomock.Call
GetClient indicates an expected call of GetClient
func (*MockIdentityServiceMockRecorder) GetServiceAuthorization ¶
func (mr *MockIdentityServiceMockRecorder) GetServiceAuthorization() *gomock.Call
GetServiceAuthorization indicates an expected call of GetServiceAuthorization
func (*MockIdentityServiceMockRecorder) GetTenantID ¶
func (mr *MockIdentityServiceMockRecorder) GetTenantID(arg0 interface{}) *gomock.Call
GetTenantID indicates an expected call of GetTenantID
func (*MockIdentityServiceMockRecorder) GetTenantName ¶
func (mr *MockIdentityServiceMockRecorder) GetTenantName(arg0 interface{}) *gomock.Call
GetTenantName indicates an expected call of GetTenantName
func (*MockIdentityServiceMockRecorder) VerifyToken ¶
func (mr *MockIdentityServiceMockRecorder) VerifyToken(arg0 interface{}) *gomock.Call
VerifyToken indicates an expected call of VerifyToken
type MockNobodyResourceService ¶
type MockNobodyResourceService struct {
// contains filtered or unexported fields
}
MockNobodyResourceService is a mock of NobodyResourceService interface
func NewMockNobodyResourceService ¶
func NewMockNobodyResourceService(ctrl *gomock.Controller) *MockNobodyResourceService
NewMockNobodyResourceService creates a new mock instance
func (*MockNobodyResourceService) EXPECT ¶
func (m *MockNobodyResourceService) EXPECT() *MockNobodyResourceServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockNobodyResourceService) VerifyResourcePath ¶
func (m *MockNobodyResourceService) VerifyResourcePath(arg0 string) bool
VerifyResourcePath mocks base method
type MockNobodyResourceServiceMockRecorder ¶
type MockNobodyResourceServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockNobodyResourceServiceMockRecorder is the mock recorder for MockNobodyResourceService
func (*MockNobodyResourceServiceMockRecorder) VerifyResourcePath ¶
func (mr *MockNobodyResourceServiceMockRecorder) VerifyResourcePath(arg0 interface{}) *gomock.Call
VerifyResourcePath indicates an expected call of VerifyResourcePath
type NoIdentityService ¶
type NoIdentityService struct { }
NoIdentityService for disabled auth
func (*NoIdentityService) GetClient ¶
func (i *NoIdentityService) GetClient() *gophercloud.ServiceClient
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 ¶
func (i *NobodyIdentityService) GetClient() *gophercloud.ServiceClient
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 ¶
func (i *NobodyIdentityService) VerifyToken(string) (schema.Authorization, error)
VerifyToken returns always authorization for nobody
type NobodyResourceService ¶
NobodyResourceService contains a definition of nobody resources (that do not require authorization)
func NewNobodyResourceService ¶
func NewNobodyResourceService(nobodyResourcePathRegexes []*regexp.Regexp) NobodyResourceService
NewNobodyResourceService is a constructor for NobodyResourceService