middlewares

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package middlewares

Index

Constants

View Source
const (
	DevAuditTable  = "daas-service-log-service-audit-dev"
	ProdAuditTable = "daas-service-log-service-audit-prod"
)
View Source
const (
	DevAuthKey    = "AUTH_JWT_PUBLIC_KEY_DEV"
	ProdAuthKey   = "AUTH_JWT_PUBLIC_KEY_PROD"
	SigningMethod = "RS256"
)
View Source
const (
	DevEntitlementUrl  = "https://grasp-daas.com/api/entitlements-dev/v1/groups/"
	ProdEntitlementUrl = "https://grasp-daas.com/api/entitlements/v1/groups/"
)
View Source
const (
	DevUsageQueue  = "daas-service-cost-handler-usage-queue-dev"
	ProdUsageQueue = "daas-service-cost-handler-usage-queue-prod"
)

Variables

This section is empty.

Functions

func NewAuditMiddleware

func NewAuditMiddleware(cfg *config.Config) echo.MiddlewareFunc

func NewAuthMiddleware

func NewAuthMiddleware(cfg *config.Config) echo.MiddlewareFunc

func NewDSContextMiddleware

func NewDSContextMiddleware(cfg *config.Config) echo.MiddlewareFunc

NewDSContextMiddleware is a middleware that adds a DSContext to the echo context that contains the user's sub, aud, rol, cls, ver, tenant_name, tenant_id, and request_id It should be the first middleware in the chain

func NewEntitlementMiddleware

func NewEntitlementMiddleware(cfg *config.Config, requiredPermissions []string) echo.MiddlewareFunc

func NewUsageMiddleware

func NewUsageMiddleware(cfg *config.Config) echo.MiddlewareFunc

Types

type AuditPayload

type AuditPayload struct {
	ID          string `json:"id"`
	TenantID    string `json:"tenant_id"`
	Url         string `json:"url"`
	Method      string `json:"method"`
	ClientIp    string `json:"client_ip"`
	StatusCode  int    `json:"status_code"`
	Sub         string `json:"sub"`
	ProcessTime string `json:"process_time"`
	CreatedAt   string `json:"created_at"`
}

type DSClaims

type DSClaims struct {
	Cls       string   `json:"cls"`
	Ver       string   `json:"ver"`
	Rol       []string `json:"rol"`
	Rsc       string   `json:"rsc"`
	TokenType string   `json:"token_type"`
	jwt.RegisteredClaims
}

type DSContext

type DSContext struct {
	echo.Context
	Sub        string    `json:"sub"`
	Aud        []string  `json:"aud"`
	Rol        []string  `json:"rol"`
	Cls        string    `json:"cls"`
	Ver        string    `json:"ver"`
	TenantName string    `json:"tenant_name"`
	TenantID   uuid.UUID `json:"tenant_id"`
	RequestID  uuid.UUID `json:"request_id"`
}

type EntitlementResponseItem

type EntitlementResponseItem struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	TenantID string `json:"tenant_id"`
}

func (*EntitlementResponseItem) FromBytes

func (group *EntitlementResponseItem) FromBytes(data []byte) error

func (*EntitlementResponseItem) ToBytes

func (group *EntitlementResponseItem) ToBytes() ([]byte, error)

type EntitlementResponseItems

type EntitlementResponseItems []EntitlementResponseItem

func (*EntitlementResponseItems) FromBytes

func (groups *EntitlementResponseItems) FromBytes(data []byte) error

func (*EntitlementResponseItems) ToBytes

func (groups *EntitlementResponseItems) ToBytes() []byte

Jump to

Keyboard shortcuts

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