Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidTokenSigningMethod invalid token signing method // ErrInvalidTokenSigningMethod = errors.New("invalid token signing method") // ErrMissingRoleName missing role name ErrMissingRoleName = errors.New("missing role name") // ErrMissingSub missing sub ErrMissingSub = errors.New("missing sub") )
View Source
var ( // ErrParseURLFailed parsing url failed ErrParseURLFailed = errors.New("parsing url failed") // ErrInvalidTokenSigningMethod invalid token signing method ErrInvalidTokenSigningMethod = errors.New("invalid token signing method") // ErrMissingToken missing authentication token ErrMissingToken = httputils.NewBadRequestError("missing authentication token") )
View Source
var ( // TODO: consider: should we move all errors to a single errors file? ErrInvalidTransportMode = errors.New("invalid transport mode") )
Functions ¶
This section is empty.
Types ¶
type AuthorizeResult ¶
type AuthorizeResult string
type Authorizer ¶
type Authorizer interface {
Authorize(ctx context.Context, req *http.Request, resource string, action string) (string, error)
}
authentication and autorization
func NewAuthorizer ¶
func NewAuthorizer(options AuthorizerOptions, repo authRepo.Repository) (Authorizer, error)
type AuthorizerOptions ¶
type AuthorizerOptions struct { AuthType AuthorizerType JWTSigningMethod jwt.SigningMethod JwtSigningSecret string AuthRepo authRepo.Repository }
type Endpoint ¶
type Endpoint struct { Path string RemotePath string TransportMode TransportMode RemotHost string Method string ExchangeName string // rabbitmq exchange RoutingKey string // rabbitmq routing key Authorized bool Options EndpointOptions }
Endpoint defines an endpoint to be routed
type EndpointOptions ¶
type EndpointOptions struct { *AuthorizerOptions *RouterOptions }
type Gateway ¶
type Gateway struct { Router Router Authorizer Authorizer Endpoint Endpoint }
type Proxy ¶
TODO: consider changing this name
func (Proxy) HandleEndpoints ¶
func (p Proxy) HandleEndpoints(ctx context.Context, repo authRepo.Repository, rabbitclient rabbit.RabbitClient) error
type RouterOptions ¶
type RouterOptions struct { }
type TransportMode ¶
type TransportMode string
TransportMode defines the way in which a request will be routed/proxied
const ( // TransportModeHTTP transports mode http TransportModeHTTP TransportMode = "http" // TransportModeAMQP amqp TransportModeAMQP TransportMode = "amqp" )
Click to show internal directories.
Click to hide internal directories.