Panda3D

Loading...
Searching...
No Matches
httpBasicAuthorization.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file httpBasicAuthorization.cxx
10 * @author drose
11 * @date 2002-10-22
12 */
13
14#include "httpBasicAuthorization.h"
15
16#ifdef HAVE_OPENSSL
17
18 using std::string;
19
20 const string HTTPBasicAuthorization::_mechanism = "basic";
21
22/**
23 *
24 */
25HTTPBasicAuthorization::
26HTTPBasicAuthorization(const HTTPAuthorization::Tokens &tokens,
27 const URLSpec &url, bool is_proxy) :
28 HTTPAuthorization(tokens, url, is_proxy)
29{
30}
31
32/**
33 *
34 */
35HTTPBasicAuthorization::
36~HTTPBasicAuthorization() {
37}
38
39/**
40 * Returns the type of authorization mechanism, represented as a string, e.g.
41 * "basic".
42 */
43 const string &HTTPBasicAuthorization::
44get_mechanism() const {
45 return _mechanism;
46}
47
48/**
49 * Generates a suitable authorization string to send to the server, based on
50 * the data stored within this object, for retrieving the indicated URL with
51 * the given username:password.
52 */
53 string HTTPBasicAuthorization::
54generate(HTTPEnum::Method, const string &,
55 const string &username, const string &) {
56 return "Basic " + base64_encode(username);
57}
58
59#endif // HAVE_OPENSSL
URLSpec
A container for a URL, e.g.
Definition urlSpec.h:28
httpBasicAuthorization.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.