AuthenticationMap 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSGDB_AUTHENTICATIONMAP
  14. #define OSGDB_AUTHENTICATIONMAP 1
  15. #include <osg/Referenced>
  16. #include <osg/ref_ptr>
  17. #include <osgDB/Export>
  18. #include <string>
  19. #include <map>
  20. namespace osgDB {
  21. class Archive;
  22. class AuthenticationDetails : public osg::Referenced
  23. {
  24. public:
  25. /** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/
  26. enum HttpAuthentication
  27. {
  28. BASIC = 1<<0,
  29. DIGEST = 1<<1,
  30. NEGOTIATE = 1<<2,
  31. GSSNegotiate = NEGOTIATE,
  32. NTLM = 1<<3,
  33. DIGEST_IE = 1<<4,
  34. NTLM_WB = 1<<5,
  35. ONLY = 1<<31,
  36. ANY = ~(DIGEST_IE),
  37. ANYSAFE = ~(BASIC|DIGEST_IE)
  38. };
  39. AuthenticationDetails(const std::string& u, const std::string& p, HttpAuthentication auth=BASIC):
  40. username(u),
  41. password(p),
  42. httpAuthentication(auth) {}
  43. std::string username;
  44. std::string password;
  45. HttpAuthentication httpAuthentication;
  46. protected:
  47. virtual ~AuthenticationDetails() {}
  48. };
  49. class OSGDB_EXPORT AuthenticationMap : public osg::Referenced
  50. {
  51. public:
  52. AuthenticationMap() {}
  53. virtual void addAuthenticationDetails(const std::string& path, AuthenticationDetails* details);
  54. virtual const AuthenticationDetails* getAuthenticationDetails(const std::string& path) const;
  55. protected:
  56. virtual ~AuthenticationMap() {}
  57. typedef std::map<std::string, osg::ref_ptr<AuthenticationDetails> > AuthenticationDetailsMap;
  58. AuthenticationDetailsMap _authenticationMap;
  59. };
  60. }
  61. #endif // OSGDB_AUTHENTICATIONMAP