sm

package
v0.21.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 34 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultGetVisibilityMetadataFunc added in v0.19.0

func DefaultGetVisibilityMetadataFunc(labelKey string) func(req *web.Request, repository storage.Repository) (metadata *filters.VisibilityMetadata, err error)

Types

type Extendable added in v0.9.7

type Extendable interface {
	Extend(context.Context, *ServiceManagerBuilder) error
}

Extendable provides a mechanism to extend further the Service Manager builder

type SecurityBuilder added in v0.9.9

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

SecurityBuilder provides means by which authentication and authorization filters can be constructed and attached in a builder-pattern style through the use of methods such as: Path(...), Method(...), WithAuthentication(...), WithAuthorization(...) and more. A key part of the builder is that once you've chained all desired authentication and authorization settings for a specific API (a set of path and method parameters) you have to use one of the provided finisher methods - Required() or Optional(). These finisher methods will ensure that the appropriate authentication/authorization filter is constructed for the desired path and methods. A finisher method also ensures a "clean slate" in terms of authorization so that you continue chaining and constructing new authorization filters.

func NewSecurityBuilder added in v0.9.9

func NewSecurityBuilder() (*SecurityBuilder, []web.Filter)

NewSecurityBuilder should be used when someone needs to build security of the API. The returned filters should be attached where the authentication and authorization needs to be in the filter chain

func (*SecurityBuilder) Authentication added in v0.9.9

func (sb *SecurityBuilder) Authentication() *SecurityBuilder

Authentication should be used to guarantee that a given path and method will have an authentication. Later on, a specific authentication can be applied for a given path/subpath Example:

Path("/**").
Method(http.MethodGet, http.MethodPut, http.MethodPost, http.MethodPatch, http.MethodDelete).
Authentication().
Required()

func (*SecurityBuilder) Authorization added in v0.9.9

func (sb *SecurityBuilder) Authorization() *SecurityBuilder

Authorization should be used to guarantee that a given path and method will have an authorization Later on, a specific authorization can be applied for a given path/subpath Example:

Path("/**").
Method(http.MethodGet, http.MethodPut, http.MethodPost, http.MethodPatch, http.MethodDelete).
Authorization().
Required()

func (*SecurityBuilder) Build added in v0.9.9

func (sb *SecurityBuilder) Build()

Builder should be called when security is ready and nothing else will be changed

func (*SecurityBuilder) Clear added in v0.9.9

func (sb *SecurityBuilder) Clear() *SecurityBuilder

Clear removes all authentication and authorization already build by the security builder

func (*SecurityBuilder) ClearAuthentication added in v0.9.9

func (sb *SecurityBuilder) ClearAuthentication() *SecurityBuilder

ClearAuthentication removes all authentication already build by the security builder

func (*SecurityBuilder) ClearAuthorization added in v0.9.9

func (sb *SecurityBuilder) ClearAuthorization() *SecurityBuilder

ClearAuthorization removes all authorization already build by the security builder

func (*SecurityBuilder) Method added in v0.9.9

func (sb *SecurityBuilder) Method(methods ...string) *SecurityBuilder

Method specifies which methods will have authentication/authorization.

func (*SecurityBuilder) Optional added in v0.9.9

func (sb *SecurityBuilder) Optional() *SecurityBuilder

Optional makes authentication/authorization optional for the requested path pattern (meaning all subpaths if "*" is used) and methods. Optional will be applied only if there are any required paths

Example 1:

no matter if Required("/v1/service_brokers") is applied
if Optional("/**") is set, then all subpaths will be optional

Example 2:

 	Required("/v1/**") is applied
 	Optional("/v1/service_brokers") is applied,
		then only "/v1/service_brokers" will be optional

Best practice is to set optional paths in the end and be as specific as possible.

func (*SecurityBuilder) Path added in v0.9.9

func (sb *SecurityBuilder) Path(paths ...string) *SecurityBuilder

Path specifies which paths will have authentication/authorization.

func (*SecurityBuilder) Required added in v0.9.9

func (sb *SecurityBuilder) Required() *SecurityBuilder

Required makes authentication/authorization required for the path pattern and methods Example 1:

no matter if Required("/v1/service_brokers") is applied
if Optional("/**") is set, then all subpaths will be optional

Example 2:

 	Required("/v1/**") is applied
 	Optional("/v1/service_brokers") is applied,
		then only "/v1/service_brokers" will be optional

func (*SecurityBuilder) Reset added in v0.9.9

func (sb *SecurityBuilder) Reset() *SecurityBuilder

Reset should be called before starting with new matchers

func (*SecurityBuilder) SetAccessLevel added in v0.9.9

func (sb *SecurityBuilder) SetAccessLevel(accessLevel web.AccessLevel) *SecurityBuilder

SetAccessLevel will set the specified access level, no matter what the authorizators returned before it. If this is set, it will override the default access level of the authorizers

func (*SecurityBuilder) WithAuthentication added in v0.9.9

func (sb *SecurityBuilder) WithAuthentication(authenticator httpsec.Authenticator) *SecurityBuilder

WithAuthentication applies the provided authenticator

func (*SecurityBuilder) WithAuthorization added in v0.9.9

func (sb *SecurityBuilder) WithAuthorization(authorizer httpsec.Authorizer) *SecurityBuilder

WithAuthorization applies the provided authorizator

func (*SecurityBuilder) WithClientID added in v0.9.9

func (sb *SecurityBuilder) WithClientID(clientID string) *SecurityBuilder

WithClientID applies authorization mechanism, which checks the JWT client id for equality with the given one

func (*SecurityBuilder) WithClientIDSuffix added in v0.9.9

func (sb *SecurityBuilder) WithClientIDSuffix(suffix string) *SecurityBuilder

WithClientIDSuffix applies authorization mechanism, which checks the JWT client id for the specified suffix

func (*SecurityBuilder) WithClientIDSuffixes added in v0.15.0

func (sb *SecurityBuilder) WithClientIDSuffixes(suffixes []string) *SecurityBuilder

WithClientIDSuffix applies authorization mechanism, which checks the JWT client id for one of the specified suffixes

func (*SecurityBuilder) WithScopes added in v0.9.9

func (sb *SecurityBuilder) WithScopes(scopes ...string) *SecurityBuilder

WithScopes applies authorization mechanism, which checks the JWT scopes for the specified scopes

type ServiceManager

type ServiceManager struct {
	Server              *server.Server
	Notificator         storage.Notificator
	NotificationCleaner *storage.NotificationCleaner
	// contains filtered or unexported fields
}

ServiceManager struct

func (*ServiceManager) Run

func (sm *ServiceManager) Run()

Run starts the Service Manager

type ServiceManagerBuilder

type ServiceManagerBuilder struct {
	*web.API

	Storage             *storage.InterceptableTransactionalRepository
	Notificator         storage.Notificator
	NotificationCleaner *storage.NotificationCleaner
	OperationMaintainer *operations.Maintainer
	OSBClientProvider   osbc.CreateFunc

	APIOptions *api.Options
	// contains filtered or unexported fields
}

ServiceManagerBuilder type is an extension point that allows adding additional filters, plugins and controllers before running ServiceManager.

func New

New returns service-manager Server with default setup

func (*ServiceManagerBuilder) Build

func (smb *ServiceManagerBuilder) Build() *ServiceManager

Build builds the Service Manager

func (*ServiceManagerBuilder) EnableMultitenancy added in v0.4.1

func (smb *ServiceManagerBuilder) EnableMultitenancy(labelKey string, extractTenantFunc func(*web.Request) (string, error)) (*ServiceManagerBuilder, error)

EnableMultitenancy enables multitenancy resources for Service Manager by labeling them with appropriate tenant value

func (*ServiceManagerBuilder) RegisterExtension added in v0.9.7

func (smb *ServiceManagerBuilder) RegisterExtension(registry Extendable) *ServiceManagerBuilder

func (*ServiceManagerBuilder) RegisterNotificationReceiversFilter added in v0.3.3

func (smb *ServiceManagerBuilder) RegisterNotificationReceiversFilter(filterFunc storage.ReceiversFilterFunc)

func (*ServiceManagerBuilder) Security added in v0.9.7

func (smb *ServiceManagerBuilder) Security() *SecurityBuilder

Security provides mechanism to apply authentication and authorization with a builder pattern

func (*ServiceManagerBuilder) WithCreateAroundTxInterceptorProvider added in v0.7.3

func (smb *ServiceManagerBuilder) WithCreateAroundTxInterceptorProvider(objectType types.ObjectType, provider storage.CreateAroundTxInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithCreateInterceptorProvider added in v0.2.0

func (smb *ServiceManagerBuilder) WithCreateInterceptorProvider(objectType types.ObjectType, provider storage.CreateInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithCreateOnTxInterceptorProvider added in v0.7.3

func (smb *ServiceManagerBuilder) WithCreateOnTxInterceptorProvider(objectType types.ObjectType, provider storage.CreateOnTxInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithDeleteAroundTxInterceptorProvider added in v0.7.3

func (smb *ServiceManagerBuilder) WithDeleteAroundTxInterceptorProvider(objectType types.ObjectType, provider storage.DeleteAroundTxInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithDeleteInterceptorProvider added in v0.2.0

func (smb *ServiceManagerBuilder) WithDeleteInterceptorProvider(objectType types.ObjectType, provider storage.DeleteInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithDeleteOnTxInterceptorProvider added in v0.7.3

func (smb *ServiceManagerBuilder) WithDeleteOnTxInterceptorProvider(objectType types.ObjectType, provider storage.DeleteOnTxInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithUpdateAroundTxInterceptorProvider added in v0.7.3

func (smb *ServiceManagerBuilder) WithUpdateAroundTxInterceptorProvider(objectType types.ObjectType, provider storage.UpdateAroundTxInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithUpdateInterceptorProvider added in v0.2.0

func (smb *ServiceManagerBuilder) WithUpdateInterceptorProvider(objectType types.ObjectType, provider storage.UpdateInterceptorProvider) *interceptorRegistrationBuilder

func (*ServiceManagerBuilder) WithUpdateOnTxInterceptorProvider added in v0.7.3

func (smb *ServiceManagerBuilder) WithUpdateOnTxInterceptorProvider(objectType types.ObjectType, provider storage.UpdateOnTxInterceptorProvider) *interceptorRegistrationBuilder

Jump to

Keyboard shortcuts

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