Barracuda Application Server C/C++ Reference
NO
AuthenticatedUser.h
1 /*
2  * ____ _________ __ _
3  * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4  * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5  * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7  * /____/
8  *
9  * Barracuda Embedded Web-Server
10  *
11  ****************************************************************************
12  * HEADER
13  *
14  * $Id: AuthenticatedUser.h 4915 2021-12-01 18:26:55Z wini $
15  *
16  * COPYRIGHT: Real Time Logic LLC, 2003 - 2019
17  *
18  * This software is copyrighted by and is the sole property of Real
19  * Time Logic LLC. All rights, title, ownership, or other interests in
20  * the software remain the property of Real Time Logic LLC. This
21  * software may only be used in accordance with the terms and
22  * conditions stipulated in the corresponding license agreement under
23  * which the software has been supplied. Any unauthorized use,
24  * duplication, transmission, distribution, or disclosure of this
25  * software is expressly forbidden.
26  *
27  * This Copyright notice may not be removed or modified without prior
28  * written consent of Real Time Logic LLC.
29  *
30  * Real Time Logic LLC. reserves the right to modify this software
31  * without notice.
32  *
33  * http://www.realtimelogic.com
34  ****************************************************************************
35  *
36  *
37  */
38 #ifndef __AuthenticatedUser_h
39 #define __AuthenticatedUser_h
40 
41 #include <HttpServer.h>
42 #include <BaServerLib.h>
43 #include <DoubleList.h>
44 #include <SplayTree.h>
45 
46 #ifndef __DOXYGEN__
47 struct AuthenticatorIntf;
48 struct UserIntf;
49 struct AuthorizerIntf;
50 struct AuthenticatedUser;
51 struct LoginRespIntf;
52 struct LoginTracker;
53 struct LoginTrackerIntf;
54 struct LoginTrackerNode;
55 struct AuthInfo;
56 #endif
57 
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 extern const char BasicAuthUser_derivedType[];
63 extern const char DigestAuthUser_derivedType[];
64 extern const char FormAuthUser_derivedType[];
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 
82 typedef enum {
83  AuthenticatedUserType_Unknown,
84  AuthenticatedUserType_Digest,
85  AuthenticatedUserType_Basic,
86  AuthenticatedUserType_Form
88 
89 
102 typedef BaBool (*AuthorizerIntf_Authorize)(
103  struct AuthorizerIntf* intf,
104  struct AuthenticatedUser* user,
105  HttpMethod httpMethod,
106  const char* path);
107 
111 typedef struct AuthorizerIntf
112 {
113 #ifdef __cplusplus
114  AuthorizerIntf(){}
115 
120 
127  bool authorize(struct AuthenticatedUser* user,
128  HttpMethod method,
129  const char* path);
130 #endif
131  AuthorizerIntf_Authorize authorizeFP;
133 
134 #define AuthorizerIntf_constructor(o, authorize) (o)->authorizeFP=authorize
135 #define AuthorizerIntf_authorize(o, user, method, path) \
136  (o)->authorizeFP(o, user, method, path)
137 
138 #ifdef __cplusplus
139 inline
140 AuthorizerIntf::AuthorizerIntf(AuthorizerIntf_Authorize authorize) {
141  AuthorizerIntf_constructor(this,authorize); }
142 inline bool
144  HttpMethod method,
145  const char* path) {
146  return AuthorizerIntf_authorize(this,user,method,path) ? true : false; }
147 #endif
148 
149 
168 typedef void (*UserIntf_GetPwd)(struct UserIntf* intf,struct AuthInfo* info);
169 
173 typedef struct UserIntf
174 {
175 #ifdef __cplusplus
176 
177  UserIntf() {}
178 
182  UserIntf(UserIntf_GetPwd getPwd);
183 
184 #endif
185  UserIntf_GetPwd getPwdFp;
187 
188 #ifdef __cplusplus
189 extern "C" {
190 #endif
191 
192 #define UserIntf_constructor(o, getPwd) (o)->getPwdFp = getPwd
193 
194 #define UserIntf_getPwd(o, username) (o)->getPwdFp(o, username)
195 #ifdef __cplusplus
196 }
197 inline UserIntf::UserIntf(
198  UserIntf_GetPwd getPwd) {
199  UserIntf_constructor(this, getPwd);
200 }
201 #endif
202 
203 
204 #ifndef __DOXYGEN__
205 typedef struct AuthUserList
206 {
207 #ifdef __cplusplus
208 #endif
209  SplayTreeNode super; /* inherits from SplayTreeNode */
210  DoubleList list; /* List of AuthenticatedUser objects */
211  struct UserIntf* userDb;
212  HttpServer* server;
213  char* username;
214  char* password;
215  int listLen; /* Number of objects in 'list' */
216 } AuthUserList;
217 #endif
218 
219 int AuthUserList_createOrCheck(struct AuthInfo* info,
220  UserIntf* userDb,
221  void** ptr,
222  size_t size);
223 
224 
225 typedef DoubleListEnumerator AuthUserListEnumerator;
226 #define AuthUserListEnumerator_constructor(e, o) \
227  DoubleListEnumerator_constructor(e, &(o)->list)
228 BA_API struct AuthenticatedUser*
229 AuthUserListEnumerator_getElement(DoubleListEnumerator* o);
230 BA_API struct AuthenticatedUser*
231 AuthUserListEnumerator_nextElement(DoubleListEnumerator* o);
232 void AuthUserList_termIfEmpty(AuthUserList* o);
233 
234 
235 
242 typedef struct AuthenticatedUser
243 {
244 #ifdef __cplusplus
245 
257  static AuthenticatedUser* get(HttpRequest* request);
258 
259 
272  static AuthenticatedUser* get(HttpSession* session);
273 
279 
282  const char* getPassword();
283 
286  const char* getName();
287 
315  void logout(bool all=false);
316 
322 
326 #endif
327  HttpSessionAttribute superClass; /*as if inherited */
328  DoubleLink dlink; /* In AuthUserList */
329  AuthUserList* authUserList;
330  const char* derivedType; /* Used for dynamic cast */
332 
333 #ifdef __cplusplus
334 extern "C" {
335 #endif
336 
337 BA_API void
338 AuthenticatedUser_constructor(AuthenticatedUser* o,
339  const char* derivedType,
340  AuthUserList* list,
342 BA_API void AuthenticatedUser_destructor(AuthenticatedUser* o);
343 BA_API AuthenticatedUser* AuthenticatedUser_get1(HttpRequest* request);
344 BA_API AuthenticatedUser* AuthenticatedUser_get2(HttpSession* session);
345 #define AuthenticatedUser_getName(o) \
346  ((o) && (o)->authUserList && (o)->authUserList->username ? \
347  (o)->authUserList->username : 0)
348 #define AuthenticatedUser_getDerivedType(o) (o)->derivedType
349 #define AuthenticatedUser_getSession(o) \
350  HttpSessionAttribute_getSession((HttpSessionAttribute*)o)
351 #define AuthenticatedUser_getPassword(o) \
352  ((o) && (o)->authUserList && (o)->authUserList->password ? \
353  (o)->authUserList->password : 0)
354 BA_API void AuthenticatedUser_logout(AuthenticatedUser* o, BaBool all);
355 BA_API AuthenticatedUserType AuthenticatedUser_getType(AuthenticatedUser* o);
356 BA_API AuthenticatedUser* AuthenticatedUser_getAnonymous(void);
357 #ifdef __cplusplus
358 }
360  return AuthenticatedUser_get1(request); }
362  return AuthenticatedUser_get2(session); }
363 inline const char* AuthenticatedUser::getName() {
364  return AuthenticatedUser_getName(this); }
366  return AuthenticatedUser_getSession(this); }
367 inline const char* AuthenticatedUser::getPassword() {
368  return AuthenticatedUser_getPassword(this); }
369 inline void AuthenticatedUser::logout(bool all) {
370  AuthenticatedUser_logout(this, all ? TRUE : FALSE); }
372  return AuthenticatedUser_getType(this); }
374  return AuthenticatedUser_getAnonymous(); }
375 #endif
376 
384 typedef AuthenticatedUser* (*AuthenticatorIntf_Authenticate)(
385  struct AuthenticatorIntf* super,
386  const char* relPath,
387  HttpCommand* cmd);
388 
389 
393 typedef struct AuthenticatorIntf
394 {
395 #ifdef __cplusplus
396  /*Only to be used as default constructor when sub-classing with C code*/
398 
403 
408  AuthenticatedUser* authenticate(const char* relPath, HttpCommand* cmd);
409 #endif
410  AuthenticatorIntf_Authenticate authenticateCB;
412 
413 #ifdef __cplusplus
414 extern "C" {
415 #endif
416 
417 #define AuthenticatorIntf_authenticate(o, relPath, cmd) \
418  (o)->authenticateCB(o, relPath, cmd)
419 
420 BA_API void AuthenticatorIntf_constructor(
422  AuthenticatorIntf_Authenticate authenticate);
423 #ifdef __cplusplus
424 }
425 inline AuthenticatorIntf::AuthenticatorIntf(
426  AuthenticatorIntf_Authenticate authenticate) {
427  AuthenticatorIntf_constructor(this,authenticate);
428 }
430  const char* relPath, HttpCommand* cmd) {
431  return AuthenticatorIntf_authenticate(this, relPath, cmd);
432 }
433 #endif
434 
435 
447 typedef void (*LoginRespIntf_Service)(struct LoginRespIntf* intf,
448  struct AuthInfo* info);
449 
458 typedef struct LoginRespIntf
459 {
460 #ifdef __cplusplus
461  LoginRespIntf() {}
466 #endif
467  LoginRespIntf_Service serviceFp;
469 
470 #define LoginRespIntf_constructor(o, service) (o)->serviceFp=service
471 #ifdef __cplusplus
472 inline LoginRespIntf::LoginRespIntf(LoginRespIntf_Service service) {
473  LoginRespIntf_constructor(this, service); }
474 #endif
475 
476 
480 typedef enum {
491 
497 
498 
503 typedef struct AuthInfo
504 {
507 
510 
512  const char* username;
513 
515  const char* upwd;
516 
520 
528 
536 
540  void* userObj;
541 
542  AuthUserList* authUserList;
543 
553 
554  U32 seed;
555  U32 seedKey;
556 
561  int maxUsers;
562 
567 
571  BaBool denied;
572 
579  BaBool recycle;
580 
591  U8 password[100];
593 
594 #define AuthInfo_constructor(o, trackerMA, cmdMA, typeMA) do {\
595  memset(o, 0, sizeof(AuthInfo));\
596  (o)->tracker=trackerMA;\
597  (o)->cmd=cmdMA;\
598  (o)->type=typeMA;\
599  (o)->maxUsers=3;\
600  (o)->ct=AuthInfoCT_Password;\
601  (o)->password[0]=0;\
602 } while(0)
603 
612 typedef BaBool (*LoginTrackerIntf_Validate)(
613  struct LoginTrackerIntf* o,
614  AuthInfo* info,
615  struct LoginTrackerNode* node);
616 
617 
625 typedef void (*LoginTrackerIntf_Login)(
626  struct LoginTrackerIntf* o,
627  AuthInfo* info,
628  struct LoginTrackerNode* node);
629 
643  struct LoginTrackerIntf* o,
644  AuthInfo* info,
645  struct LoginTrackerNode* node);
646 
654  struct LoginTrackerIntf* o,
655  struct LoginTrackerNode* node);
656 
657 
662 typedef struct LoginTrackerIntf
663 {
664 #ifdef __cplusplus
665 
673  LoginTrackerIntf_LoginFailed loginFailed,
674  LoginTrackerIntf_TerminateNode terminateNode);
675 #endif
676  LoginTrackerIntf_Validate validate;
678  LoginTrackerIntf_LoginFailed loginFailed;
679  LoginTrackerIntf_TerminateNode terminateNode;
681 
682 #define LoginTrackerIntf_constructor(\
683  o, validateMA, loginMA, loginFailedMA, terminateNodeMA) do {\
684  (o)->validate=validateMA;\
685  (o)->login=loginMA;\
686  (o)->loginFailed=loginFailedMA;\
687  (o)->terminateNode=terminateNodeMA;\
688 } while(0)
689 #define LoginTrackerIntf_validate(o, request, node) \
690  (o)->validate(o, request, node)
691 #define LoginTrackerIntf_login(o, request, user) \
692  (o)->login(o, request, user)
693 #define LoginTrackerIntf_loginFailed(o, node, loginName) \
694  (o)->loginFailed(o, node, loginName)
695 #define LoginTrackerIntf_terminateNode(o, node) \
696  (o)->terminateNode(o, node)
697 
698 #ifdef __cplusplus
700  LoginTrackerIntf_Validate validate,
702  LoginTrackerIntf_LoginFailed loginFailed,
703  LoginTrackerIntf_TerminateNode terminateNode) {
704  LoginTrackerIntf_constructor(this,validate,login,loginFailed,terminateNode);
705 }
706 #endif
707 
708 
713 typedef struct LoginTrackerNode
714 {
715 #ifdef __cplusplus
716 
718  U32 getCounter();
719 
722  U32 getAuxCounter();
723 
726  void setAuxCounter(U32 count);
727 
730  HttpSockaddr* getAddr();
731 
734  void setUserData(void* data);
735 
738  void* getUserData();
739 
742  BaTime getTime();
743 #endif
744  SplayTreeNode super;
745  DoubleLink dlink;
746  HttpSockaddr addr;
747  void* userData;
748  BaTime t;
749  U32 loginCounter;
750  U32 auxCounter;
752 
753 #define LoginTrackerNode_getCounter(o) (o)->loginCounter
754 #define LoginTrackerNode_getAuxCounter(o) (o)->auxCounter
755 #define LoginTrackerNode_setAuxCounter(o, count) (o)->auxCounter=count
756 #define LoginTrackerNode_getAddr(o) (&(o)->addr)
757 #define LoginTrackerNode_setUserData(o, data) (o)->userData=data
758 #define LoginTrackerNode_getUserData(o) (o)->userData
759 #define LoginTrackerNode_getTime(o) (o)->t
760 
761 #ifdef __cplusplus
763  return LoginTrackerNode_getCounter(this);
764 }
766  return LoginTrackerNode_getAuxCounter(this);
767 }
768 
769 inline void LoginTrackerNode::setAuxCounter(U32 count) {
770  LoginTrackerNode_setAuxCounter(this, count);
771 }
772 
773 inline HttpSockaddr* LoginTrackerNode::getAddr() {
774  return LoginTrackerNode_getAddr(this);
775 }
776 inline void LoginTrackerNode::setUserData(void* data) {
777  LoginTrackerNode_setUserData(this, data);
778 }
780  return LoginTrackerNode_getUserData(this);
781 }
783  return LoginTrackerNode_getTime(this);
784 }
785 #endif
786 
809 typedef struct LoginTracker
810 {
811 #ifdef __cplusplus
812 
818  LoginTracker(U32 noOfLoginTrackerNodes,
819  LoginTrackerIntf* intf,
821 
824  void clearCache();
825 
829 
834 
841  LoginTrackerNode* find(HttpRequest* request);
842 #endif
843  SplayTree tree;
844  DoubleList dInUseList;
845  DoubleList dFreeList;
846  LoginTrackerIntf* loginTrackerIntf;
847  U32 cursor;
848  U32 noOfLoginTrackerNodes;
849  LoginTrackerNode* nodes;
851 
852 
853 #ifdef __cplusplus
854 extern "C" {
855 #endif
856 BA_API void LoginTracker_constructor(LoginTracker* o,
857  U32 noOfLoginTrackerNodes,
858  LoginTrackerIntf* intf,
859  AllocatorIntf* allocator);
860 BA_API void LoginTracker_destructor(LoginTracker* o);
861 BA_API void LoginTracker_clearCache(LoginTracker* o);
862 BA_API LoginTrackerNode* LoginTracker_getFirstNode(LoginTracker* o);
863 BA_API LoginTrackerNode* LoginTracker_getNextNode(
865 BA_API LoginTrackerNode* LoginTracker_find(LoginTracker*o, HttpRequest* req);
866 BA_API void LoginTracker_loginFailed(
867  LoginTracker* o, AuthInfo* info);
868 BA_API BaBool LoginTracker_validate(LoginTracker* o, AuthInfo* info);
869 BA_API void LoginTracker_login(LoginTracker* o, AuthInfo* info);
870 #ifdef __cplusplus
871 }
872 inline LoginTracker::LoginTracker(U32 noOfLoginTrackerNodes,
873  LoginTrackerIntf* intf,
874  AllocatorIntf* allocator) {
875  LoginTracker_constructor(this, noOfLoginTrackerNodes, intf, allocator);
876 }
878  LoginTracker_clearCache(this);
879 }
881  return LoginTracker_getFirstNode(this);
882 }
884  return LoginTracker_getNextNode(this,n);
885 }
887  return LoginTracker_find(this,request);
888 }
889 #endif
890 
891  /* end of Authentication */
893 
894 /* Internal func */
895 #ifndef NO_SHARKSSL
896 void calculateHA1Hex(
897  const char* realm, const char* uname, const char* pwd, U8 hexbuf[33]);
898 #endif
899 
900 #endif
HttpRequest
The HttpServer creates an HttpRequest object when the HttpServer parses a client request.
Definition: HttpServer.h:819
AuthInfo::cmd
HttpCommand * cmd
The request/response container object.
Definition: AuthenticatedUser.h:509
AuthenticatorIntf_Authenticate
AuthenticatedUser *(* AuthenticatorIntf_Authenticate)(struct AuthenticatorIntf *super, const char *relPath, HttpCommand *cmd)
The authenticator callback method for the abstract class AuthenticatorIntf.
Definition: AuthenticatedUser.h:384
AuthenticatorIntf
struct AuthenticatorIntf AuthenticatorIntf
Abstract interface class implemented by DigestAuthenticator, FormAuthenticator and DigestAuthenticato...
AuthorizerIntf_Authorize
BaBool(* AuthorizerIntf_Authorize)(struct AuthorizerIntf *intf, struct AuthenticatedUser *user, HttpMethod httpMethod, const char *path)
Prototype for the Authorize callback method.
Definition: AuthenticatedUser.h:102
AllocatorIntf
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:83
AuthenticatedUser::getType
AuthenticatedUserType getType()
Returns the authenticator type that was used to authenticate this user.
Definition: AuthenticatedUser.h:371
AuthInfo::maxUsers
int maxUsers
Max number of concurrent logins for this user.
Definition: AuthenticatedUser.h:561
HttpMethod
HttpMethod
HTTP method types.
Definition: HttpServer.h:783
AuthorizerIntf::authorize
bool authorize(struct AuthenticatedUser *user, HttpMethod method, const char *path)
Returns TRUE if user is authorized.
Definition: AuthenticatedUser.h:143
AuthorizerIntf
An abstract class, which you must implement, provides a method of authorizing an authenticated user.
Definition: AuthenticatedUser.h:112
LoginTracker
struct LoginTracker LoginTracker
The LoginTracker class is an optional security enhancement that can be installed in an instance of on...
HttpSession
Provides a way to identify a user across more than one page request or visit to a web site,...
Definition: HttpServer.h:1975
AuthInfo::password
U8 password[100]
Must be set by UserIntf_GetPwd if the user is found.
Definition: AuthenticatedUser.h:591
LoginRespIntf
The LoginRespIntf is an abstract class, which must be implemented when using one of DigestAuthenticat...
Definition: AuthenticatedUser.h:459
AuthenticatedUser::getName
const char * getName()
Returns the user's name.
Definition: AuthenticatedUser.h:363
AuthInfoCT
AuthInfoCT
AuthInfo Credential Type can optionally be used by the UserIntf_GetPwd callback function.
Definition: AuthenticatedUser.h:480
AuthInfoCT_Invalid
@ AuthInfoCT_Invalid
Set when getpwd callback failed comparing AuthInfo::upwd with stored password.
Definition: AuthenticatedUser.h:495
LoginTracker::getFirstNode
LoginTrackerNode * getFirstNode()
Return first LoginTrackerNode in the cache or NULL if cache empty.
Definition: AuthenticatedUser.h:880
LoginTrackerNode
struct LoginTrackerNode LoginTrackerNode
A LoginTrackerNode keeps track of how many times a user using a specific IP address has attempted to ...
AuthInfo::loginAttempts
int loginAttempts
Shows the number of login attempts if the LoginTracker is active.
Definition: AuthenticatedUser.h:566
LoginTrackerNode::setUserData
void setUserData(void *data)
Store application data in this node.
Definition: AuthenticatedUser.h:776
LoginTrackerNode::getAddr
HttpSockaddr * getAddr()
Return the HttpSockaddr.
Definition: AuthenticatedUser.h:773
AuthInfoCT_HA1
@ AuthInfoCT_HA1
The password is returned as a HA1 hash, which is: MD5(username ":" realm ":" password)
Definition: AuthenticatedUser.h:486
AuthInfo::ct
AuthInfoCT ct
The ct parameter can optionally be set by the UserIntf_GetPwd function.
Definition: AuthenticatedUser.h:535
LoginRespIntf
struct LoginRespIntf LoginRespIntf
The LoginRespIntf is an abstract class, which must be implemented when using one of DigestAuthenticat...
LoginTrackerNode::setAuxCounter
void setAuxCounter(U32 count)
Set auxiliary counter.
Definition: AuthenticatedUser.h:769
AllocatorIntf::getDefault
static AllocatorIntf * getDefault(void)
Returns a pointer to a predefined AllocatorIntf class.
Definition: AllocatorIntf.h:156
AuthInfo
struct AuthInfo AuthInfo
An instance of the AuthInfo struct is created on the stack in the Barracuda authenticators and is use...
AuthInfo
An instance of the AuthInfo struct is created on the stack in the Barracuda authenticators and is use...
Definition: AuthenticatedUser.h:504
LoginTrackerNode::getCounter
U32 getCounter()
Returns the number of login attempts.
Definition: AuthenticatedUser.h:762
LoginTrackerNode::getTime
BaTime getTime()
Returns the time for the latest login attempt.
Definition: AuthenticatedUser.h:782
AuthInfo::recycle
BaBool recycle
Force another client to log out.
Definition: AuthenticatedUser.h:579
HttpSessionAttribute_Destructor
void(* HttpSessionAttribute_Destructor)(struct HttpSessionAttribute *o)
HttpSessionAttribute termination callback function.
Definition: HttpServer.h:1897
LoginRespIntf_Service
void(* LoginRespIntf_Service)(struct LoginRespIntf *intf, struct AuthInfo *info)
This callback function is called if the user failed to authenticate with one of DigestAuthenticator,...
Definition: AuthenticatedUser.h:447
AuthenticatedUser
Abstract base class implemented by BasicAuthUser, FormAuthUser and DigestAuthUser.
Definition: AuthenticatedUser.h:243
LoginTracker
The LoginTracker class is an optional security enhancement that can be installed in an instance of on...
Definition: AuthenticatedUser.h:810
BaTime
S64 BaTime
An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:10 GMT – i....
Definition: GenPrimT.h:93
LoginTrackerIntf_TerminateNode
void(* LoginTrackerIntf_TerminateNode)(struct LoginTrackerIntf *o, struct LoginTrackerNode *node)
Prototype for the TerminateNode callback method.
Definition: AuthenticatedUser.h:653
AuthInfo::maxInactiveInterval
BaTime maxInactiveInterval
This variable specifies the time, in seconds, between client requests before the user is automaticall...
Definition: AuthenticatedUser.h:552
LoginTrackerNode
A LoginTrackerNode keeps track of how many times a user using a specific IP address has attempted to ...
Definition: AuthenticatedUser.h:714
AuthInfo::user
AuthenticatedUser * user
The authenticated user object if the user is authenticated.
Definition: AuthenticatedUser.h:519
HttpSessionAttribute
The interface to an HttpSession attribute.
Definition: HttpServer.h:1928
LoginTrackerIntf
The interface between the LoginTracker and the application code.
Definition: AuthenticatedUser.h:663
AuthenticatedUser::getPassword
const char * getPassword()
Returns the user's password.
Definition: AuthenticatedUser.h:367
LoginTracker::LoginTracker
LoginTracker(U32 noOfLoginTrackerNodes, LoginTrackerIntf *intf, AllocatorIntf *allocator=AllocatorIntf::getDefault())
Create a LoginTracker instance.
Definition: AuthenticatedUser.h:872
AuthInfoCT_Valid
@ AuthInfoCT_Valid
Set when getpwd callback successfully compared AuthInfo::upwd with stored password.
Definition: AuthenticatedUser.h:490
AuthenticatorIntf::authenticate
AuthenticatedUser * authenticate(const char *relPath, HttpCommand *cmd)
Authenticate the user.
Definition: AuthenticatedUser.h:429
AuthInfoCT_Password
@ AuthInfoCT_Password
The default.
Definition: AuthenticatedUser.h:482
LoginTrackerNode::getAuxCounter
U32 getAuxCounter()
Get auxiliary counter.
Definition: AuthenticatedUser.h:765
AuthenticatedUser::logout
void logout(bool all=false)
Logout user and terminate the session object.
Definition: AuthenticatedUser.h:369
LoginTracker::getNextNode
LoginTrackerNode * getNextNode(LoginTrackerNode *n)
Return the next LoginTrackerNode in the cache or NULL if no more nodes.
Definition: AuthenticatedUser.h:883
AuthenticatedUserType
AuthenticatedUserType
The authenticator types.
Definition: AuthenticatedUser.h:82
UserIntf
Interface class used by the Authentication classes.
Definition: AuthenticatedUser.h:174
AuthInfo::userObj
void * userObj
An object that can be set by the callbacks for exchanging information.
Definition: AuthenticatedUser.h:540
LoginTrackerIntf::LoginTrackerIntf
LoginTrackerIntf(LoginTrackerIntf_Validate validate, LoginTrackerIntf_Login login, LoginTrackerIntf_LoginFailed loginFailed, LoginTrackerIntf_TerminateNode terminateNode)
Create a LoginTrackerIntf.
Definition: AuthenticatedUser.h:699
AuthenticatorIntf
Abstract interface class implemented by DigestAuthenticator, FormAuthenticator and DigestAuthenticato...
Definition: AuthenticatedUser.h:394
LoginTrackerIntf_Login
void(* LoginTrackerIntf_Login)(struct LoginTrackerIntf *o, AuthInfo *info, struct LoginTrackerNode *node)
Prototype for the Login tracker method.
Definition: AuthenticatedUser.h:625
AuthenticatedUser::getAnonymous
static AuthenticatedUser * getAnonymous()
non public
Definition: AuthenticatedUser.h:373
HttpCommand
The HttpCommand class is a container class for the HttpRequest and HttpResponse command pair.
Definition: HttpServer.h:1834
AuthInfo::username
const char * username
The user name if the client sends login information.
Definition: AuthenticatedUser.h:512
LoginTracker::find
LoginTrackerNode * find(HttpRequest *request)
Find LoginTrackerNode in cache by using the IP address from the request object.
Definition: AuthenticatedUser.h:886
UserIntf_GetPwd
void(* UserIntf_GetPwd)(struct UserIntf *intf, struct AuthInfo *info)
The GetPwd callback function searches for info->username and sets AuthInfo::password if found and/or ...
Definition: AuthenticatedUser.h:168
LoginTrackerIntf_Validate
BaBool(* LoginTrackerIntf_Validate)(struct LoginTrackerIntf *o, AuthInfo *info, struct LoginTrackerNode *node)
Prototype for the validate callback method.
Definition: AuthenticatedUser.h:612
AuthInfo::type
AuthenticatedUserType type
The AuthenticatedUser type.
Definition: AuthenticatedUser.h:527
LoginTrackerIntf
struct LoginTrackerIntf LoginTrackerIntf
The interface between the LoginTracker and the application code.
LoginTrackerNode::getUserData
void * getUserData()
Fetch stored application data in this node.
Definition: AuthenticatedUser.h:779
AuthenticatedUser::getSession
HttpSession * getSession()
Get the session object.
Definition: AuthenticatedUser.h:365
AuthInfo::upwd
const char * upwd
The password provided by the user, if any.
Definition: AuthenticatedUser.h:515
LoginTrackerIntf_LoginFailed
void(* LoginTrackerIntf_LoginFailed)(struct LoginTrackerIntf *o, AuthInfo *info, struct LoginTrackerNode *node)
Prototype for the LoginFailed callback method.
Definition: AuthenticatedUser.h:642
AuthInfo::denied
BaBool denied
Flag set if the user is denied access by the LoginTracker.
Definition: AuthenticatedUser.h:571
AuthenticatedUser::get
static AuthenticatedUser * get(HttpRequest *request)
Returns a pointer to an instance of class AuthenticatedUser if a session object exists and if the use...
Definition: AuthenticatedUser.h:359
AuthorizerIntf
struct AuthorizerIntf AuthorizerIntf
An abstract class, which you must implement, provides a method of authorizing an authenticated user.
AuthInfo::tracker
struct LoginTracker * tracker
The tracker object if any.
Definition: AuthenticatedUser.h:506
HttpServer
The Web Server.
Definition: HttpServer.h:2887
UserIntf
struct UserIntf UserIntf
Interface class used by the Authentication classes.
AuthenticatedUser
struct AuthenticatedUser AuthenticatedUser
Abstract base class implemented by BasicAuthUser, FormAuthUser and DigestAuthUser.
LoginTracker::clearCache
void clearCache()
Clear the LoginTrackerNode cache.
Definition: AuthenticatedUser.h:877