()
| 439 | } |
| 440 | |
| 441 | func (hs *HttpServer) NewHttpServerHelper() *plugins.HttpServerPluginHelper { |
| 442 | h := &plugins.HttpServerPluginHelper{} |
| 443 | h.StopSignal = hs.signals.stop |
| 444 | |
| 445 | h.AuthWithHttpCallbackFunc = func(req *common.HttpKnockRequest, res *common.ResourceData) (*common.ServerKnockAckMsg, error) { |
| 446 | return hs.handleHttpOpenResource(req, res) |
| 447 | } |
| 448 | |
| 449 | // Session helper functions for plugins |
| 450 | h.SessionGet = func(ctx *gin.Context, key string) interface{} { |
| 451 | session := sessions.Default(ctx) |
| 452 | return session.Get(key) |
| 453 | } |
| 454 | h.SessionSet = func(ctx *gin.Context, key string, val interface{}) { |
| 455 | session := sessions.Default(ctx) |
| 456 | session.Set(key, val) |
| 457 | } |
| 458 | h.SessionSave = func(ctx *gin.Context) error { |
| 459 | session := sessions.Default(ctx) |
| 460 | return session.Save() |
| 461 | } |
| 462 | h.SessionClear = func(ctx *gin.Context) { |
| 463 | session := sessions.Default(ctx) |
| 464 | session.Clear() |
| 465 | } |
| 466 | |
| 467 | return h |
| 468 | } |
| 469 | |
| 470 | // FindPluginHandler returns the plugin handler for the given ASP ID |
| 471 | // It delegates the task to the underlying UDP server's FindPluginHandler method. |
no test coverage detected