WebStack

docs/Webware/NOTES.txt

52:f97734674679
2004-02-08 paulb [project @ 2004-02-08 21:42:26 by paulb] Added notes about authentication/authorisation in Webware.
     1 Webware's CGI adapter:
     2 
     3 Copy the Webware/WebKit/Adapters/WebKit.cgi file to your CGI directory (eg.
     4 /home/httpd/cgi-bin), then add a line like this to httpd.conf:
     5 
     6 ScriptAlias /webkit "/home/httpd/cgi-bin/WebKit.cgi"
     7 
     8 --------
     9 
    10 Authentication/authorisation in Webware:
    11 
    12 Since Webware provides some kind of CGI emulation environment, the actual HTTP
    13 headers involved with authentication/authorisation are not available to the
    14 WebStack transaction. Therefore, WebStack depends on Webware having access to
    15 the REMOTE_USER environment variable set by the Web server, and with Apache,
    16 this variable is only ever set when Apache itself has performed
    17 authentication. Whilst applications can send the "WWW-Authenticate" header to
    18 HTTP clients, unless Apache has been instructed to process the resulting
    19 username/password information, the REMOTE_USER will apparently remain
    20 undefined.
    21 
    22 Consequently, it is recommended that the following kind of definition is added
    23 to httpd.conf (for Apache) in order to give applications access to
    24 username/password details:
    25 
    26 <Location "/webkit/auth">
    27     AuthType Basic
    28     AuthName "AuthResource"
    29     AuthUserFile /usr/local/apache2/conf/users
    30     require valid-user
    31 </Location>
    32 
    33 The details of the application's deployment, including the exact pathname of
    34 the users file and the appropriate access policy, must obviously be defined
    35 according to the actual application concerned.
    36 
    37 --------
    38 
    39 For Webware releases beyond 0.8.1:
    40 
    41 WebStack applications are supported as contexts within WebKit, meaning that a
    42 certain prefix in the URL determines whether an application is sent a
    43 particular request.
    44 
    45 Each context must be defined in the Webware/WebKit/Configs/Application.config
    46 file within the 'Contexts' dictionary entry; for example:
    47 
    48 'simple': '/home/paulb/Software/Python/WebStack/examples/Webware/SimpleContext',
    49 
    50 Note that the path to the context directory must be absolute, although the
    51 context directory may reside within WebKit itself such that the path may then
    52 make use of the special %(WebKitPath)s substitution.
    53 
    54 Note also that the name of the context (eg. 'simple') must not be the same as
    55 the name of any other package used within the application (and possibly any
    56 other applications in the application server), with the only reasonable
    57 exception being the context package name itself (eg. 'SimpleContext').
    58 Otherwise, the existing package will become overridden by the contents of the
    59 context itself.  Therefore, given that the Simple package is used to hold the
    60 actual application code, it is not wise to use 'Simple' as the context name.
    61 
    62 Running the application server:
    63 
    64 Change into the WebKit directory within Webware. Then, specifying the
    65 appropriate PYTHONPATH, invoke the application server. For example:
    66 
    67 PYTHONPATH=../../../WebStack:../../../WebStack/examples/Common ./AppServer
    68 
    69 The WebStack package must reside on the PYTHONPATH, along with the package
    70 containing the application itself.
    71 
    72 --------
    73 
    74 For Webware 0.8.1 or earlier:
    75 
    76 Support for WebStack applications is provided by a Webware plug-in which
    77 associates Webware resources having certain suffixes with certain WebStack
    78 applications, regardless of the context within which a resource appears. In
    79 order to make use of such a scheme, a WebStack application would have its
    80 resources residing in an arbitrary URL "hierarchy", but with each resource
    81 having the special suffix to indicate that it belongs to that application.
    82 
    83 In the case of an application whose chosen suffix is ".xyz", it would be
    84 possible, for example, to define resources residing at the following URL
    85 paths:
    86 
    87   tasks/my-tasks.xyz
    88   tasks/outstanding/urgent.xyz
    89   agenda/today.xyz
    90 
    91 This is somewhat counter-intuitive to typical Webware concepts, and it is
    92 recommended that Webware releases beyond 0.8.1 are used together with the
    93 appropriate WebStack context mechanisms instead of using this plug-in scheme.
    94 
    95 In order to support such behaviour, the patches in the
    96 WebStack/patches/Webware/WebKit directory must be applied to WebKit:
    97 
    98 cd Webware/WebKit
    99 patch -p0 < ../../WebStack/patches/Webware/WebKit/Application.py-0.8.1.diff
   100 patch -p0 < ../../WebStack/patches/Webware/WebKit/HTTPRequest.py-0.8.1.diff
   101 
   102 Each plug-in, representing a WebStack application, should be visible in the
   103 Webware root directory. A symbolic link can be used to make each example
   104 appear; the Simple application being installed as follows:
   105 
   106 cd Webware
   107 ln -s ../WebStack/examples/Webware/SimpleApp
   108 
   109 Running the application server:
   110 
   111 Change into the WebKit directory within Webware. Then, specifying the
   112 appropriate PYTHONPATH, invoke the application server. For example:
   113 
   114 PYTHONPATH=../../WebStack:../../WebStack/examples/Common ./AppServer
   115 
   116 The WebStack package must reside on the PYTHONPATH, along with the package
   117 containing the application itself.