modified present3D to allow multiple --login arguments like osgViewer, added --login option to osgvnc example
This commit is contained in:
parent
adb6ae849d
commit
99491e46ec
@ -336,15 +336,11 @@ int main( int argc, char **argv )
|
|||||||
std::string url, username, password;
|
std::string url, username, password;
|
||||||
while(arguments.read("--login",url, username, password))
|
while(arguments.read("--login",url, username, password))
|
||||||
{
|
{
|
||||||
if (!osgDB::Registry::instance()->getAuthenticationMap())
|
osgDB::Registry::instance()->getOrCreateAuthenticationMap()->addAuthenticationDetails(
|
||||||
{
|
|
||||||
osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
|
|
||||||
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(
|
|
||||||
url,
|
url,
|
||||||
new osgDB::AuthenticationDetails(username, password)
|
new osgDB::AuthenticationDetails(username, password)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ class EscapeHandler : public osgGA::GUIEventHandler
|
|||||||
int main(int argc,char** argv)
|
int main(int argc,char** argv)
|
||||||
{
|
{
|
||||||
osg::ArgumentParser arguments(&argc, argv);
|
osg::ArgumentParser arguments(&argc, argv);
|
||||||
|
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>", "Provide authentication information for http file access.");
|
||||||
|
arguments.getApplicationUsage()->addCommandLineOption("--password <password>", "Provide password for any vnc url on command line not mentioned in --login.");
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
||||||
@ -52,6 +54,15 @@ int main(int argc,char** argv)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string url, username, password;
|
||||||
|
while (arguments.read("--login", url, username, password))
|
||||||
|
{
|
||||||
|
osgDB::Registry::instance()->getOrCreateAuthenticationMap()->addAuthenticationDetails(
|
||||||
|
url,
|
||||||
|
new osgDB::AuthenticationDetails(username, password)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=1; i<arguments.argc(); ++i)
|
for(int i=1; i<arguments.argc(); ++i)
|
||||||
{
|
{
|
||||||
if (!arguments.isOption(i))
|
if (!arguments.isOption(i))
|
||||||
@ -60,8 +71,12 @@ int main(int argc,char** argv)
|
|||||||
|
|
||||||
if (!password.empty())
|
if (!password.empty())
|
||||||
{
|
{
|
||||||
if (!osgDB::Registry::instance()->getAuthenticationMap()) osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
|
const osgDB::AuthenticationMap* authenticationMap = osgDB::Registry::instance()->getOrCreateAuthenticationMap();
|
||||||
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(hostname, new osgDB::AuthenticationDetails("", password));
|
const osgDB::AuthenticationDetails* details = authenticationMap->getAuthenticationDetails(hostname);
|
||||||
|
if (details == NULL)
|
||||||
|
{
|
||||||
|
authenticationMap->addAuthenticationDetails(hostname, new osgDB::AuthenticationDetails("", password));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osgWidget::VncClient> vncClient = new osgWidget::VncClient;
|
osg::ref_ptr<osgWidget::VncClient> vncClient = new osgWidget::VncClient;
|
||||||
|
Loading…
Reference in New Issue
Block a user