| 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 | |
|---|
| 14 | #ifndef OSGDB_AUTHENTICATIONMAP |
|---|
| 15 | #define OSGDB_AUTHENTICATIONMAP 1 |
|---|
| 16 | |
|---|
| 17 | #include <osg/Referenced> |
|---|
| 18 | #include <osg/ref_ptr> |
|---|
| 19 | |
|---|
| 20 | #include <osgDB/Export> |
|---|
| 21 | |
|---|
| 22 | #include <string> |
|---|
| 23 | #include <map> |
|---|
| 24 | |
|---|
| 25 | namespace osgDB { |
|---|
| 26 | |
|---|
| 27 | class Archive; |
|---|
| 28 | |
|---|
| 29 | class AuthenticationDetails : public osg::Referenced |
|---|
| 30 | { |
|---|
| 31 | public: |
|---|
| 32 | |
|---|
| 33 | /** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/ |
|---|
| 34 | enum HttpAuthentication |
|---|
| 35 | { |
|---|
| 36 | BASIC = 1<<0, |
|---|
| 37 | DIGEST = 1<<1, |
|---|
| 38 | NTLM = 1<<2, |
|---|
| 39 | GSSNegotiate = 1<<2, |
|---|
| 40 | ANY = ~0, |
|---|
| 41 | ANYSAFE = ~BASIC |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | AuthenticationDetails(const std::string& u, const std::string& p, HttpAuthentication auth=BASIC): |
|---|
| 45 | username(u), |
|---|
| 46 | password(p), |
|---|
| 47 | httpAuthentication(auth) {} |
|---|
| 48 | |
|---|
| 49 | std::string username; |
|---|
| 50 | std::string password; |
|---|
| 51 | HttpAuthentication httpAuthentication; |
|---|
| 52 | |
|---|
| 53 | protected: |
|---|
| 54 | virtual ~AuthenticationDetails() {} |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | class OSGDB_EXPORT AuthenticationMap : public osg::Referenced |
|---|
| 58 | { |
|---|
| 59 | public: |
|---|
| 60 | |
|---|
| 61 | AuthenticationMap() {} |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | virtual void addAuthenticationDetails(const std::string& path, AuthenticationDetails* details); |
|---|
| 65 | |
|---|
| 66 | virtual const AuthenticationDetails* getAuthenticationDetails(const std::string& path) const; |
|---|
| 67 | |
|---|
| 68 | protected: |
|---|
| 69 | |
|---|
| 70 | virtual ~AuthenticationMap() {} |
|---|
| 71 | |
|---|
| 72 | typedef std::map<std::string, osg::ref_ptr<AuthenticationDetails> > AuthenticationDetailsMap; |
|---|
| 73 | AuthenticationDetailsMap _authenticationMap; |
|---|
| 74 | |
|---|
| 75 | }; |
|---|
| 76 | |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | #endif // OSGDB_AUTHENTICATIONMAP |
|---|