Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/downloader/httpAuthorization.h

Go to the documentation of this file.
00001 // Filename: httpAuthorization.h
00002 // Created by:  drose (22Oct02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef HTTPAUTHORIZATION_H
00020 #define HTTPAUTHORIZATION_H
00021 
00022 #include "pandabase.h"
00023 
00024 // This module requires OpenSSL to compile, even though it doesn't
00025 // actually use any OpenSSL code, because it is a support module for
00026 // HTTPChannel, which *does* use OpenSSL code.
00027 
00028 #ifdef HAVE_SSL
00029 
00030 #include "referenceCount.h"
00031 #include "httpEnum.h"
00032 
00033 class URLSpec;
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //       Class : HTTPAuthorization
00037 // Description : A base class for storing information used to fulfill
00038 //               authorization requests in the past, which can
00039 //               possibly be re-used for future requests to the same
00040 //               server.
00041 //
00042 //               This class does not need to be exported from the DLL
00043 //               because it has no public interface; it is simply a
00044 //               helper class for HTTPChannel.
00045 ////////////////////////////////////////////////////////////////////
00046 class HTTPAuthorization : public ReferenceCount {
00047 public:
00048   typedef pmap<string, string> Tokens;
00049   typedef pmap<string, Tokens> AuthenticationSchemes;
00050 
00051 protected:
00052   HTTPAuthorization(const Tokens &tokens, const URLSpec &url,
00053                     bool is_proxy);
00054 public:
00055   virtual ~HTTPAuthorization();
00056 
00057   virtual const string &get_mechanism() const=0;
00058   virtual bool is_valid();
00059 
00060   INLINE const string &get_realm() const;
00061   INLINE const vector_string &get_domain() const;
00062 
00063   virtual string generate(HTTPEnum::Method method, const string &request_path,
00064                           const string &username, const string &body)=0;
00065 
00066   static void parse_authentication_schemes(AuthenticationSchemes &schemes,
00067                                            const string &field_value);
00068   static URLSpec get_canonical_url(const URLSpec &url);
00069   static string base64_encode(const string &s);
00070 
00071 protected:
00072   static size_t scan_quoted_or_unquoted_string(string &result, 
00073                                                const string &source, 
00074                                                size_t start);
00075 
00076 protected:
00077   string _realm;
00078   vector_string _domain;
00079 };
00080 
00081 #include "httpAuthorization.I"
00082 
00083 #endif  // HAVE_SSL
00084 
00085 #endif
00086 

Generated on Fri May 2 00:36:47 2003 for Panda by doxygen1.3