summaryrefslogtreecommitdiff
path: root/protocols/ace/INet/HTTP_BasicAuthentication.h
blob: 110b4bd0c88cd96f8f142fafe01447a1021be652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// $Id$

/**
 * @file HTTP_BasicAuthentication.h
 *
 * @author Martin Corino <mcorino@remedy.nl>
 */

#ifndef ACE_HTTP_BASIC_AUTHENTICATION_H
#define ACE_HTTP_BASIC_AUTHENTICATION_H

#include /**/ "ace/pre.h"

#include /**/ "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/INet/INet_Export.h"
#include "ace/INet/HTTP_Request.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
  {
    namespace HTTP
      {
        /**
        * @class ACE_HTTP_BasicAuthentication
        *
        * @brief Provides support for HTTP Basic Authentication credentials.
        *
        */
        class ACE_INET_Export BasicAuthentication
          {
            public:
              /// Constructor
              BasicAuthentication();

              /// Constructor. Sets user id and password.
              BasicAuthentication(const ACE_CString& user, const ACE_CString& passwd);

              /// Constructor. Decodes cedentials from request (if any).
              BasicAuthentication(const Request& request);

              /// Destructor
              virtual ~BasicAuthentication();

              /// Set user id.
              void user (const ACE_CString& user);

              /// Get user id.
              const ACE_CString& user () const;

              /// Set password.
              void password (const ACE_CString& passwd);

              /// Get password.
              const ACE_CString& password () const;

              /// Add authentication header with encoded credentials to request.
              void set_credentials (Request& request) const;

              static const char* SCHEME;

            private:
              // prevent copying
              BasicAuthentication(const BasicAuthentication&);
              BasicAuthentication& operator =(BasicAuthentication&);

              ACE_CString user_;
              ACE_CString passwd_;
          };
      }
  }

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "ace/INet/HTTP_BasicAuthentication.inl"
#endif

#include /**/ "ace/post.h"
#endif /* ACE_HTTP_BASIC_AUTHENTICATION_H */