Documentation ¶
Overview ¶
this middleware function is to revoke token jwt if status user blocked or suspend
Index ¶
- Constants
- Variables
- func AddValidatorLibs()
- func DeleteRedis(id string) (err error)
- func GetRedis(id string) (result string, err error)
- func GetRedisClient(redisHost, redisPort, redisPassword string, redisDb int) error
- func JSONEncode(obj interface{}) string
- func JsonMinify(jsonB []byte) ([]byte, error)
- func LogAudittrailData(funcName, desc, source, commType string, key *[]string, ...)
- func LogAudittrailProcess(funcName, desc, info string, key *[]string)
- func LoggerErrorHub(err interface{})
- func PushMessage(data interface{})
- func ReadBody(c echo.Context, idem string) (map[string]interface{}, string, error)
- func RevokeToken(next echo.HandlerFunc) echo.HandlerFunc
- func StoreRedis(id string, data interface{}, duration time.Duration) (err error)
- func VerifCsrf(next echo.HandlerFunc) echo.HandlerFunc
- func VerifIdemKey(next echo.HandlerFunc) echo.HandlerFunc
- func VerifyMD5(idemKey string, request []byte) (string, error)
- type AuditTrialData
- type AuditTrialProcess
- type DataAudittrailProcess
- type Detail
- type Headers
- type MessagePayloadAudit
- type RMqAutoConnect
- type Request
- type RequestAndResponse
- type ResponseApi
- func (r *ResponseApi) Accepted(data interface{})
- func (r *ResponseApi) BadRequest(message string, intenalCode string)
- func (r *ResponseApi) InternalServerError(err error)
- func (r *ResponseApi) Out(code int, message, internalCode string, status string, data interface{})
- func (r *ResponseApi) Success(message string, data interface{})
- func (r *ResponseApi) Unauthorized(message string, intenalCode string)
- type ResponseAudit
Constants ¶
View Source
const ( AUDITTRAIL_PROCESS = "audit-trail-process" AUDITTRAIL_DATA = "audit-trail-data" TIME_FORMAT = "2006-01-02 15:04:05" )
View Source
const ( Numeric string = "^-?[0-9]+$" Key string = "^[-a-zA-Z0-9_-]+$" )
Variables ¶
View Source
var AppName *string
View Source
var Channel *amqp.Channel
View Source
var Conn *amqp.Connection
View Source
var Que *string
Functions ¶
func AddValidatorLibs ¶
func AddValidatorLibs()
func DeleteRedis ¶
func GetRedisClient ¶
func JSONEncode ¶
func JSONEncode(obj interface{}) string
func JsonMinify ¶
func LogAudittrailData ¶
func LogAudittrailData(funcName, desc, source, commType string, key *[]string, data *RequestAndResponse)
add audittrail data
func LogAudittrailProcess ¶
add audittrail process
func LoggerErrorHub ¶
func LoggerErrorHub(err interface{})
func RevokeToken ¶
func RevokeToken(next echo.HandlerFunc) echo.HandlerFunc
func VerifIdemKey ¶
func VerifIdemKey(next echo.HandlerFunc) echo.HandlerFunc
Types ¶
type AuditTrialData ¶
type AuditTrialData struct { Subject string `json:"Subject,omitempty"` Function string `json:"Function,omitempty"` Description string `json:"Description,omitempty"` Key []string `json:"Key"` // Source string `json:"Source"` // internal or external CommunicationType string `json:"CommunicationType"` Data *RequestAndResponse `json:"Data"` }
type AuditTrialProcess ¶
type AuditTrialProcess struct { Subject string `json:"Subject,omitempty"` Function string `json:"Function,omitempty"` Description string `json:"Description,omitempty"` Key []string `json:"Key"` Data DataAudittrailProcess `json:"Data"` }
type DataAudittrailProcess ¶
type Headers ¶
type Headers struct { IdempotencyKey string `json:"idem_key"` Session string `json:"session"` Csrf string `json:"csrf"` }
func (*Headers) ValiadateHeaderCsrf ¶
func (h *Headers) ValiadateHeaderCsrf() interface{}
func (*Headers) ValiadateHeaderIdem ¶
func (h *Headers) ValiadateHeaderIdem() interface{}
type MessagePayloadAudit ¶
type RMqAutoConnect ¶
type RMqAutoConnect struct {
// contains filtered or unexported fields
}
func SetUpRabbitMq ¶
func SetUpRabbitMq(host, port, vhost, username, password, audittrailQue, appName string) RMqAutoConnect
service must call this func in main function
func (*RMqAutoConnect) CloseConnection ¶
func (r *RMqAutoConnect) CloseConnection()
service must call this method in defer func
type Request ¶
type Request struct { Time string `json:"Time"` Path string `json:"Path,omitempty"` QueryString interface{} `json:"QueryString,omitempty"` Header interface{} `json:"Header,omitempty"` Param interface{} `json:"Param,omitempty"` Body interface{} `json:"Body,omitempty"` IpAddress string `json:"IpAddress,omitempty"` BrowserId int `json:"BrowserId,omitempty"` Latitude string `json:"Latitude,omitempty"` Longitude string `json:"Longitude,omitempty"` }
type RequestAndResponse ¶
type RequestAndResponse struct { Request Request `json:"Request"` Response ResponseAudit `json:"Response"` }
type ResponseApi ¶
type ResponseApi struct { Code int `json:"code"` Status string `json:"status"` Message string `json:"message"` InternalCode string `json:"internal_code,omitempty"` Data interface{} `json:"data,omitempty"` }
func (*ResponseApi) BadRequest ¶
func (r *ResponseApi) BadRequest(message string, intenalCode string)
BadRequest is method for bad request
func (*ResponseApi) InternalServerError ¶
func (r *ResponseApi) InternalServerError(err error)
InternalServerError is method for internal server error
func (*ResponseApi) Out ¶
func (r *ResponseApi) Out(code int, message, internalCode string, status string, data interface{})
func (*ResponseApi) Success ¶
func (r *ResponseApi) Success(message string, data interface{})
func (*ResponseApi) Unauthorized ¶
func (r *ResponseApi) Unauthorized(message string, intenalCode string)
unauthorized user
type ResponseAudit ¶
Click to show internal directories.
Click to hide internal directories.