Panda3D

httpBasicAuthorization.cxx

00001 // Filename: httpBasicAuthorization.cxx
00002 // Created by:  drose (22Oct02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "httpBasicAuthorization.h"
00016 
00017 #ifdef HAVE_OPENSSL
00018 
00019 const string HTTPBasicAuthorization::_mechanism = "basic";
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: HTTPBasicAuthorization::Constructor
00023 //       Access: Protected
00024 //  Description: 
00025 ////////////////////////////////////////////////////////////////////
00026 HTTPBasicAuthorization::
00027 HTTPBasicAuthorization(const HTTPAuthorization::Tokens &tokens, 
00028                        const URLSpec &url, bool is_proxy) : 
00029   HTTPAuthorization(tokens, url, is_proxy)
00030 {
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: HTTPBasicAuthorization::Destructor
00035 //       Access: Public, Virtual
00036 //  Description: 
00037 ////////////////////////////////////////////////////////////////////
00038 HTTPBasicAuthorization::
00039 ~HTTPBasicAuthorization() {
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: HTTPBasicAuthorization::get_mechanism
00044 //       Access: Public, Virtual
00045 //  Description: Returns the type of authorization mechanism,
00046 //               represented as a string, e.g. "basic".
00047 ////////////////////////////////////////////////////////////////////
00048 const string &HTTPBasicAuthorization::
00049 get_mechanism() const {
00050   return _mechanism;
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: HTTPBasicAuthorization::generate
00055 //       Access: Public, Virtual
00056 //  Description: Generates a suitable authorization string to send
00057 //               to the server, based on the data stored within this
00058 //               object, for retrieving the indicated URL with the
00059 //               given username:password.
00060 ////////////////////////////////////////////////////////////////////
00061 string HTTPBasicAuthorization::
00062 generate(HTTPEnum::Method, const string &,
00063          const string &username, const string &) {
00064   return "Basic " + base64_encode(username);
00065 }
00066 
00067 #endif  // HAVE_OPENSSL
 All Classes Functions Variables Enumerations