Leosac  0.8.0
Open Source Access Control
Leosac::Module::WebSockAPI::MethodHandler Class Referenceabstract

The base class for API method handler implementation. More...

#include <MethodHandler.hpp>

+ Inheritance diagram for Leosac::Module::WebSockAPI::MethodHandler:
+ Collaboration diagram for Leosac::Module::WebSockAPI::MethodHandler:

Public Types

using Factory = MethodHandlerUPtr(*)(RequestContext)
 

Public Member Functions

 MethodHandler (RequestContext ctx)
 
virtual ~MethodHandler ()=default
 
json process (const ClientMessage &msg)
 The public process() method. More...
 
UserSecurityContextsecurity_context ()
 
ExecutionContext exec_context ()
 Returns a representation of the execution context of this request. More...
 

Static Public Member Functions

static MethodHandlerUPtr create (RequestContext)
 An example method that should be implemented in all subclasses. More...
 

Protected Member Functions

virtual std::vector< ActionActionParamrequired_permission (const json &req) const =0
 Return a list of "Action" / "ActionParam" that must pass before the request is processed. More...
 

Protected Attributes

RequestContext ctx_
 

Private Member Functions

virtual json process_impl (const json &req)=0
 The API method implementation. More...
 

Detailed Description

The base class for API method handler implementation.

The class defines the very simple interface that may be implemented by the various API method implementation.

Each subclass should provide a static method to instanciate a handler object of the subclass type.

Definition at line 46 of file MethodHandler.hpp.

Member Typedef Documentation

◆ Factory

Constructor & Destructor Documentation

◆ MethodHandler()

Leosac::Module::WebSockAPI::MethodHandler::MethodHandler ( RequestContext  ctx)
inline

Definition at line 51 of file MethodHandler.hpp.

◆ ~MethodHandler()

virtual Leosac::Module::WebSockAPI::MethodHandler::~MethodHandler ( )
virtualdefault

Member Function Documentation

◆ create()

static MethodHandlerUPtr Leosac::Module::WebSockAPI::MethodHandler::create ( RequestContext  )
inlinestatic

An example method that should be implemented in all subclasses.

Definition at line 69 of file MethodHandler.hpp.

◆ exec_context()

ExecutionContext MethodHandler::exec_context ( )

Returns a representation of the execution context of this request.

This context can be passed to service.

Definition at line 52 of file MethodHandler.cpp.

◆ process()

json MethodHandler::process ( const ClientMessage msg)

The public process() method.

It uses Non Virtual Interface pattern and will forward the call to the process_impl() method.

Definition at line 30 of file MethodHandler.cpp.

◆ process_impl()

◆ required_permission()

◆ security_context()

UserSecurityContext & MethodHandler::security_context ( )

Definition at line 44 of file MethodHandler.cpp.

Member Data Documentation

◆ ctx_

RequestContext Leosac::Module::WebSockAPI::MethodHandler::ctx_
protected

Definition at line 90 of file MethodHandler.hpp.


The documentation for this class was generated from the following files: