Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
DigestAuthenticator.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 ****************************************************************************
11 * HEADER
12 *
13 * $Id: DigestAuthenticator.h 5978 2026-09-11 16:13:48Z wini $
14 *
15 * COPYRIGHT: Real Time Logic LLC, 2003-2026
16 *
17 * This software is copyrighted by and is the sole property of Real
18 * Time Logic LLC. All rights, title, ownership, or other interests in
19 * the software remain the property of Real Time Logic LLC. This
20 * software may only be used in accordance with the terms and
21 * conditions stipulated in the corresponding license agreement under
22 * which the software has been supplied. Any unauthorized use,
23 * duplication, transmission, distribution, or disclosure of this
24 * software is expressly forbidden.
25 *
26 * This Copyright notice may not be removed or modified without prior
27 * written consent of Real Time Logic LLC.
28 *
29 * Real Time Logic LLC. reserves the right to modify this software
30 * without notice.
31 *
32 * http://www.realtimelogic.com
33 ****************************************************************************
34 *
35 */
36
39#ifndef __DigestAuthenticator_h
40#define __DigestAuthenticator_h
41
42#include <AuthenticatedUser.h>
43
54typedef struct DigestAuthenticator
55#ifdef __cplusplus
56: public AuthenticatorIntf
57{
60
73 DigestAuthenticator(UserIntf* userDbIntf,
74 const char* realm,
75 LoginRespIntf* sendLogin);
76
82 void setLoginTracker(LoginTracker* tracker);
83
95 static int setAutHeader(const char* realm, HttpResponse* response);
96
105 void setStrictMode(bool enableStrictMode=false);
106
107#else
108{
109 AuthenticatorIntf superClass; /*as if inherited*/
110#endif
111 UserIntf* userDbIntf;
112 LoginTracker* tracker;
113 char* realm;
114 LoginRespIntf* sendLogin;
115 BaBool strictMode;
116 BaBool filterMsDomain; /* If remove MS domain name prefix */
118
119
120#ifdef __cplusplus
121extern "C" {
122#endif
131 UserIntf* userDbIntf,
132 const char* realm,
133 LoginRespIntf* sendLogin);
142#define DigestAuthenticator_setLoginTracker(o,loginTracker) \
143 (o)->tracker=loginTracker
149#define DigestAuthenticator_setFilterMsDomain(o, state) \
150 (o)->filterMsDomain=state
151/* Returns 0 on success (including an ignored include), E_MALLOC when header
152 * storage fails, or E_IS_COMMITTED. Failure does not set status 401. */
158 const char*,HttpResponse*);
162#define DigestAuthenticator_setStrictMode(o, enableStrictMode) \
163 (o)->strictMode=enableStrictMode
164BA_API BaBool DigestAuthenticator_isDigest(AuthenticatedUser* user);
165#ifdef __cplusplus
166}
168 const char* realm,
169 LoginRespIntf* sendLogin) {
170 DigestAuthenticator_constructor(this,userDbIntf,realm,sendLogin);
171}
174}
176 const char* realm, HttpResponse* resp) {
177 return DigestAuthenticator_setAutHeader(realm,resp); }
178inline void DigestAuthenticator::setStrictMode(bool enableStrictMode) {
179 DigestAuthenticator_setStrictMode(this, enableStrictMode ? TRUE : FALSE);
180}
181
182#endif
183 /* end of Authentication */
185
186#endif
void setLoginTracker(LoginTracker *tracker)
Configure login-attempt tracking.
Definition: DigestAuthenticator.h:172
static int setAutHeader(const char *realm, HttpResponse *response)
Sets an HTTP Digest authentication challenge and status code.
Definition: DigestAuthenticator.h:175
BA_API int DigestAuthenticator_setAutHeader(const char *, HttpResponse *)
C form of DigestAuthenticator::setAutHeader.
void setStrictMode(bool enableStrictMode=false)
Control repeated Digest validation for an authenticated session.
Definition: DigestAuthenticator.h:178
BA_API void DigestAuthenticator_constructor(DigestAuthenticator *o, UserIntf *userDbIntf, const char *realm, LoginRespIntf *sendLogin)
C form of DigestAuthenticator::DigestAuthenticator.
#define DigestAuthenticator_setLoginTracker(o, loginTracker)
C form of DigestAuthenticator::setLoginTracker.
Definition: DigestAuthenticator.h:142
#define DigestAuthenticator_setStrictMode(o, enableStrictMode)
Control repeated Digest validation for an authenticated session.
Definition: DigestAuthenticator.h:162
BA_API void DigestAuthenticator_destructor(DigestAuthenticator *o)
Release authenticator-owned realm storage after detaching all users.
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Abstract base class implemented by BasicAuthUser, FormAuthUser and DigestAuthUser.
Definition: AuthenticatedUser.h:272
Abstract interface class implemented by DigestAuthenticator, FormAuthenticator and BasicAuthenticator...
Definition: AuthenticatedUser.h:425
Implements HTTP Digest authentication.
Definition: DigestAuthenticator.h:57
DigestAuthenticator()
Leave storage uninitialized; call DigestAuthenticator_constructor before use.
Definition: DigestAuthenticator.h:59
This object is used when sending response messages back to the client.
Definition: HttpServer.h:1379
The LoginRespIntf is an abstract class, which must be implemented when using one of DigestAuthenticat...
Definition: AuthenticatedUser.h:504
The LoginTracker class is an optional security enhancement that can be installed in an instance of on...
Definition: AuthenticatedUser.h:891
User database interface used by the authentication classes.
Definition: AuthenticatedUser.h:195