Documentation
¶
Overview ¶
Package middlewares
Index ¶
- Constants
- func NewAuditMiddleware(cfg *config.Config) echo.MiddlewareFunc
- func NewAuthMiddleware(cfg *config.Config) echo.MiddlewareFunc
- func NewDSContextMiddleware(cfg *config.Config) echo.MiddlewareFunc
- func NewEntitlementMiddleware(cfg *config.Config, requiredPermissions []string) echo.MiddlewareFunc
- func NewUsageMiddleware(cfg *config.Config) echo.MiddlewareFunc
- type AuditPayload
- type DSClaims
- type DSContext
- type EntitlementResponseItem
- type EntitlementResponseItems
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 NewAuthMiddleware ¶
func NewDSContextMiddleware ¶
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 NewUsageMiddleware ¶
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 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
Click to show internal directories.
Click to hide internal directories.