Documentation ¶
Index ¶
- type WebServer
- func (w *WebServer) ExtractJwtClaims(c *gin.Context) map[string]interface{}
- func (w *WebServer) GetHostAddress() string
- func (w *WebServer) Port() uint
- func (w *WebServer) RemoveDNSRecordset()
- func (w *WebServer) Serve() error
- func (w *WebServer) SetRouteGroupCustomMiddleware(routeGroupName string, routerFunc []gin.HandlerFunc) bool
- func (w *WebServer) UseTls() bool
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) GetHostAddress ¶ added in v1.1.0
GetHostAddress returns either the dns based url as configured, if route53 dns url is configured, this function will first create dns recordset for the local ip, then return dns url
func (*WebServer) RemoveDNSRecordset ¶ added in v1.1.0
func (w *WebServer) RemoveDNSRecordset()
RemoveDNSRecordset will delete dns resource recordset for the currently registered entry from route53 (originally registered via GetHostAddress function)
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