#include <CGIApplicationAuthenticated.h>
Inheritance diagram for ClearSilver::CGIApplicationAuthenticated:

Public Types | |
Pointer types | |
|
typedef boost::shared_ptr< CGIApplication > | Ptr |
Public Member Functions | |
| void | swap (TraceObject &) throw () |
| void | operator() () |
| CGI application entry point. | |
Constructors and assignment operators | |
| CGIApplicationAuthenticated () | |
| Default constructor. | |
| CGIApplicationAuthenticated (boost::shared_ptr< Authenticator >) | |
| Construct from an Authenticator object. | |
| CGIApplicationAuthenticated (const char *, boost::shared_ptr< Authenticator >) | |
| Construct from the name of an HDF file. | |
| CGIApplicationAuthenticated (const std::string &, boost::shared_ptr< Authenticator >) | |
| Construct from the name of an HDF file. | |
| CGIApplicationAuthenticated (const ClearSilver::HDF &, boost::shared_ptr< Authenticator >) | |
| Construct from an existing HDF dataset. | |
| CGIApplicationAuthenticated (const CGIApplicationAuthenticated &) | |
| Copy constructor. | |
| virtual | ~CGIApplicationAuthenticated () throw () |
| Destructor. | |
| CGIApplicationAuthenticated & | operator= (const CGIApplicationAuthenticated &) |
| Assignment operator. | |
| void | swap (CGIApplicationAuthenticated &) throw () |
| Swap contents with another object. | |
Constructors and assignment operators | |
| void | swap (CGIApplication &) throw () |
| Swap contents with another object. | |
Access to ClearSilver data structures | |
| CGI | cgi () const |
| ClearSilver CGI data structure. | |
| HDF | hdf () |
| ClearSilver HDF dataset. | |
Static Public Member Functions | |
| static bool & | debug () |
| Access the debug flag. | |
Protected Member Functions | |
| virtual bool | authenticate () |
| Verify authentication of query. | |
CGI application hooks | |
Derived classes are expected to provide their own implementations of these methods. The CGI application provided by the default version of these methods is a NOP. | |
| virtual void | initialize () |
| Initial setup of data structures. | |
| virtual void | execute () |
| Execute main CGI program. | |
| virtual void | display () |
| Display CGI output. | |
| virtual void | execute_unauthenticated () |
| Execute the CGI program after authentication fails. | |
| virtual void | display_unauthenticated () |
| Display CGI output in absence of authentication. | |
| virtual void | terminate () |
| Final cleanup of data structures. | |
| virtual void | handle_exception (const std::string &) |
| Handle exceptions appropriately. | |
The class provides a template for constructing authenticated CGI applications. The function call operator (operator ()) provides the underlying CGI application logic, while the protected CGI application hooks provide means for derived classes to provide application-specific code. This class differs from the CGIApplication class from which it is derived by containing a pointer to a Authenticator class that encapsulates the authentication policy.
By providing a framework for a CGI application, this class follows the Template Method pattern. Because its behavior can be modified depending on the contained Authenticataor object, this class also follows the Strategy pattern. Both are described in the following reference.
Definition at line 79 of file CGIApplicationAuthenticated.h.
|
|
Verify authentication of query. This method determines whether or not to authenticate each request. The implementation provided by this class delegates the authentication policy to the contained Authenticator object. Implements ClearSilver::CGIApplication. Definition at line 90 of file CGIApplicationAuthenticated.cc. References ClearSilver::CGIApplication::hdf(). |
|
|
Access the debug flag. If the debug flag is true, syslog(3) messages with priority LOG_DEBUG will be logged. Definition at line 299 of file CGIApplication.cc. Referenced by ClearSilver::CGIApplication::display(), ClearSilver::CGIApplication::display_unauthenticated(), ClearSilver::CGIApplication::operator()(), and ClearSilver::CGIApplication::operator=(). |
|
|
Display CGI output. This is the main output method for a CGI application. It is expected to only create output, not modify data structures or satisfy requests. By default, this method takes the name of the ClearSilver template from the HDF dataset associated with the CGIApplication. The value of the following HDF variables are searched in order:
Definition at line 232 of file CGIApplication.cc. References ClearSilver::CGIApplication::cgi(), ClearSilver::CGIApplication::debug(), ClearSilver::CGI::display(), ClearSilver::HDF::find(), ClearSilver::CGIApplication::hdf(), and ClearSilver::ConstHDFNode::value(). Referenced by ClearSilver::CGIApplication::operator()(). |
|
|
Display CGI output in absence of authentication. This method is analogous to display() when authentication was unsuccessful (i.e., when authenticate() returns false). By default, this method takes the name of the ClearSilver template from the HDF dataset associated with the CGIApplication. The value of the following HDF variables are searched in order:
Reimplemented in ClearSilver::CGIApplicationUnauthenticated. Definition at line 261 of file CGIApplication.cc. References ClearSilver::CGIApplication::cgi(), ClearSilver::CGIApplication::debug(), ClearSilver::CGI::display(), ClearSilver::HDF::find(), ClearSilver::CGIApplication::hdf(), and ClearSilver::ConstHDFNode::value(). Referenced by ClearSilver::CGIApplication::operator()(). |
|
|
Execute main CGI program. This is the main execution path for CGI applications. It is expected that this method will perform the following operations.
Definition at line 229 of file CGIApplication.cc. Referenced by ClearSilver::CGIApplication::operator()(). |
|
|
Execute the CGI program after authentication fails. This method is analogous to execute() when authentication was unsuccessful (i.e., when authenticate() returns false). Reimplemented in ClearSilver::CGIApplicationUnauthenticated. Definition at line 258 of file CGIApplication.cc. Referenced by ClearSilver::CGIApplication::operator()(). |
|
|
Handle exceptions appropriately. This method allows CGI applications to handle the messages generated by exceptions. Be default, a message is rethrown as a ClearSilverException object. Referenced by ClearSilver::CGIApplication::operator()(). |
|
|
CGI application entry point. This method is the main entry point for CGI applications. Essentially, it executes the following application logic.
initialize (); if (authenticate ()) { execute (); display (); } else { execute_unauthenticated (); display_unauthenticated (); } terminate (); Definition at line 147 of file CGIApplication.cc. References ClearSilver::CGIApplication::authenticate(), std::basic_string< _CharT, _Traits, _Alloc >::c_str(), ClearSilver::CGIApplication::debug(), ClearSilver::CGIApplication::display(), ClearSilver::CGIApplication::display_unauthenticated(), ClearSilver::CGIApplication::execute(), ClearSilver::CGIApplication::execute_unauthenticated(), ClearSilver::CGIApplication::handle_exception(), ClearSilver::CGI::hdf(), ClearSilver::CGIApplication::initialize(), ClearSilver::CGIApplication::terminate(), std::runtime_error::what(), std::logic_error::what(), and ClearSilver::ClearSilverException::what(). |
|
|
Final cleanup of data structures. This method is responsible for returning the HDF data structure to the state it was in prior to handling a request. The CGI data structures will automatically be removed from the dataset (see HDFNode::remove_cgi()); however, any other modifications made during the request processing must be reversed here. Definition at line 288 of file CGIApplication.cc. Referenced by ClearSilver::CGIApplication::operator()(). |
1.4.5