From 7ec7b8d9cb8c5697ef578c8202353edb03c19b2e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 Jul 2008 15:04:19 +0000 Subject: [PATCH] Added --login url username password http authentication option --- applications/osgviewer/osgviewer.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/applications/osgviewer/osgviewer.cpp b/applications/osgviewer/osgviewer.cpp index 7492a977f..32cbb72e7 100644 --- a/applications/osgviewer/osgviewer.cpp +++ b/applications/osgviewer/osgviewer.cpp @@ -39,6 +39,7 @@ int main(int argc, char** argv) arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("--image ","Load an image and render it on a quad"); arguments.getApplicationUsage()->addCommandLineOption("--dem ","Load an image/DEM and render it on a HeightField"); + arguments.getApplicationUsage()->addCommandLineOption("--login ","Provide authentication information for http file access."); osgViewer::Viewer viewer(arguments); @@ -62,6 +63,19 @@ int main(int argc, char** argv) return 1; } + std::string url, username, password; + while(arguments.read("--login",url, username, password)) + { + if (!osgDB::Registry::instance()->getAuthenticationMap()) + { + osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap); + osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails( + url, + new osgDB::AuthenticationDetails(username, password) + ); + } + } + // set up the camera manipulators. { osg::ref_ptr keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;