1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * authenaction.h -- authenticating users
|
---|
4 | * Copyright (C) 1999 DigiLib Systems Limited, New Zealand
|
---|
5 | *
|
---|
6 | * PUT COPYRIGHT NOTICE HERE
|
---|
7 | *
|
---|
8 | * $Id: authenaction.h 369 1999-07-11 10:47:32Z rjmcnab $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 |
|
---|
13 | #ifndef AUTHENACTION_H
|
---|
14 | #define AUTHENACTION_H
|
---|
15 |
|
---|
16 | #include "gsdlconf.h"
|
---|
17 | #include "action.h"
|
---|
18 | #include "text_t.h"
|
---|
19 | #include "receptionist.h"
|
---|
20 |
|
---|
21 | // information about a single user
|
---|
22 | struct userinfo_t {
|
---|
23 | void clear ();
|
---|
24 | userinfo_t () {clear();}
|
---|
25 |
|
---|
26 | enum status_t {enabled, disabled, invalid, failed, permissiondenied};
|
---|
27 |
|
---|
28 | text_t username;
|
---|
29 | text_t password;
|
---|
30 | status_t status;
|
---|
31 | text_t groups; // comma separated list
|
---|
32 | };
|
---|
33 |
|
---|
34 | // information about all the users
|
---|
35 | typedef map<text_t, userinfo_t, lttext_t> userinfo_tmap;
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | // note: you need to tell this action about the receptionist
|
---|
40 | // using set_receptionist
|
---|
41 |
|
---|
42 | class authenaction : public action {
|
---|
43 | protected:
|
---|
44 | text_t passwdfile;
|
---|
45 | text_t keyfile;
|
---|
46 | int keydecay;
|
---|
47 |
|
---|
48 | userinfo_tmap userinfo;
|
---|
49 |
|
---|
50 | receptionist *recpt;
|
---|
51 |
|
---|
52 | public:
|
---|
53 | authenaction ();
|
---|
54 | virtual ~authenaction () {}
|
---|
55 |
|
---|
56 | void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
|
---|
57 |
|
---|
58 | void configure (const text_t &key, const text_tarray &cfgline);
|
---|
59 | bool init (ostream &logout);
|
---|
60 |
|
---|
61 | text_t get_action_name () {return "a";}
|
---|
62 |
|
---|
63 | bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
|
---|
64 | ostream &logout);
|
---|
65 | bool check_external_cgiargs (cgiargsinfoclass &argsinfo,
|
---|
66 | cgiargsclass &args,
|
---|
67 | outconvertclass &outconvert,
|
---|
68 | const text_t &saveconf,
|
---|
69 | ostream &logout);
|
---|
70 |
|
---|
71 | void get_cgihead_info (cgiargsclass &args, response_t &response,
|
---|
72 | text_t &response_data, ostream &logout);
|
---|
73 |
|
---|
74 | void define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
75 | recptproto *collectproto, ostream &logout);
|
---|
76 | void define_external_macros (displayclass &disp, cgiargsclass &args,
|
---|
77 | recptproto *collectproto, ostream &logout);
|
---|
78 |
|
---|
79 | bool do_action (cgiargsclass &args, recptproto *collectproto,
|
---|
80 | displayclass &disp, outconvertclass &outconvert,
|
---|
81 | ostream &textout, ostream &logout);
|
---|
82 | };
|
---|
83 |
|
---|
84 |
|
---|
85 | #endif
|
---|