You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by David Arnold <da...@northcoast.com> on 2004/07/18 21:32:00 UTC

multiple users on a single machine

All,

We're writing a series of examinations that will be placed online. We
anticipate that many students will use the computers in our academic
support center (ASC) to take these examinations online. This means that
it's possible that different students could enter our examination page from
the same machine at different times of the day or week. Of course, other
students might also be entering our examination area from different
machines in the ASC or from their home machines.

We will have the usernames and passwords of all eligible students in a
database on our server. The main directory where students first enter is
protected with modperl, maybe something like:

Alias /online_testing/ "/usr/local/apache/htdocs/online_testing/"
<Location /online_testing/>
        AuthName OnlineTesting
        AuthType Basic
        PerlAuthenHandler Apache::AuthTieDBI
        PerlSetVar TieDatabase mysql:test_www
        PerlSetVar TieTable user_info:user_name:passwd
        require valid-user
        PerlAccessHandler Apache::GateKeeper
        PerlSetVar Gate open
</Location>

Suppose that student A logs into our main page using his username and
password against our database. He is authenticated and presented with links
to examinations. Suppose, for example, that one of these links is "Exam#1".
When student A clicks this link, a second perl script needs to take his
username and password and use the FDFToolkit from Adobe to import this
information into a waiting PDF document. My first question is this: Is the
username and password that student A used to login available to this next
perl script? (Assume that all files are in
/usr/local/apache/htdocs/online_testing/ or perhaps in subdirectories of
this path.) 

If there are documents, tutorials, or other pointers similar to this kind
of application that would be a valuable read, I would appreciate any pointers.

Secondly, suppose at the same time student B has logged on to the opening
page, but from another machine. Is this run in a separate child process? If
student B also tries to access "Exam#1", will things go well?

Thirdly, what happens if student B logs onto the same machine as student A,
but later in the day?

I think my note points to my confusion of all these "processes" and how
they work. I still don't have a handle on that. Any help or explanation
will be appreciated.

Thanks.



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: multiple users on a single machine

Posted by Frank Maas <fr...@cheiron-it.nl>.
On Sun, Jul 18, 2004 at 12:32:00PM -0700, David Arnold wrote:
> 
> Suppose that student A logs into our main page using his username and
> [...]
> information into a waiting PDF document. My first question is this: Is the
> username and password that student A used to login available to this next
> perl script?

> I think my note points to my confusion of all these "processes" and how
> they work. I still don't have a handle on that. Any help or explanation
> will be appreciated.

I thought so. Honest question: did you read the mod_perl cookbook
(http://www.modperlcookbook.org) and/or Practical mod_perl 
(http://modperlbook.org) before you started (or during) your 
exploration of mod_perl? I think it is essential you do, because
you seem not aware of the "request" cycle.

Anyway, assuming that you program this sensibly, there is no such thing 
as a process that is authenticated: it is a request. Whenever the user
requests a resource from your webserver, this "request" is put through 
different phases, one of which can be an authenticating phase. 
Whichever way of authentication you choose, the authentication 
information is shared with "next" phases, of which content serving is 
one. So: yes you have that information available when serving an Adobe 
document.
Perhaps to help you: although sites give a different impression:
there is no such thing as "logging in". When you "log in" to a site
you merely use a mechanism that "automatically" authenticates you
every time from then on. This can be done using basic authentication
(in which case your browser simply keeps your username and password
at hand), using cookies and using sessions (where the server keeps 
your information at hand).

> Secondly, suppose at the same time student B has logged on to the opening
> page, but from another machine. Is this run in a separate child process? If
> student B also tries to access "Exam#1", will things go well?

See above. Which process is used for Student B is not relevant. The 
process should not keep this information "in core".

> Thirdly, what happens if student B logs onto the same machine as student A,
> but later in the day?

Ah! Now this can be a tricky part... If you use basic authentication
(that one with the nasty popup box asking for a username and a password)
the browser offers a "service" to store these to get you in any time.
To avoid this in your case, simply use a session scheme (see books)
with a session that expires in a sensible way (read: rather quickly,
but not too quick).

Hope this helps, but do yourself a favour and read one of the books 
mentioned. Certainly if you plan to do these kinds of important 
applications.

--Frank

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html