Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WebServer ¶
type WebServer struct {
// csrf handler definitions
CsrfErrorHandler func(c *gin.Context)
CsrfTokenGetterHandler func(c *gin.Context) string
// http error handler definitions
HttpStatusErrorHandler func(status int, trace string, c *gin.Context)
// jwt auth handler definitions
LoginRequestDataPtr interface{}
AuthenticateHandler func(loginRequestDataPtr interface{}) (loggedInCredentialPtr interface{})
AddClaimsHandler func(loggedInCredentialPtr interface{}) (identityKeyValue string, claims map[string]interface{})
GetIdentityHandler func(claims map[string]interface{}) interface{}
AuthorizerHandler func(loggedInCredentialPtr interface{}, c *gin.Context) bool
LoginResponseHandler func(c *gin.Context, statusCode int, token string, expires time.Time)
LogoutResponseHandler func(c *gin.Context, statusCode int)
RefreshTokenResponseHandler func(c *gin.Context, statusCode int, token string, expires time.Time)
NoRouteHandler func(claims map[string]interface{}, c *gin.Context)
MiddlewareErrorEvaluator func(e error, c *gin.Context) string
TimeHandler func() time.Time
// route definitions
Routes map[string]*ginw.RouteDefinition
// contains filtered or unexported fields
}
WebServer defines gin http web server, loads config from yaml config file, contains fields to config custom handlers
func NewWebServer ¶
NewWebServer creates a prepared web server for further setup and use
func (*WebServer) ExtractJwtClaims ¶
ExtractJwtClaims returns map from gin context extract
func (*WebServer) SetRouteGroupCustomMiddleware ¶
func (w *WebServer) SetRouteGroupCustomMiddleware(routeGroupName string, routerFunc []gin.HandlerFunc) bool
SetRouterGroupCustomMiddleware sets additional custom gin middleware (RouterFunc) to engine or router groups,
routerGroupName = blank, to set routerFunc to engine routerGroupName = not blank, to set routerFunc to the named router group if found
return true if set; false if not set
Click to show internal directories.
Click to hide internal directories.