[mapguide-commits] r9131 - in sandbox/adsk/3.2o: . Common/PlatformBase/Services Server/src/Services/Resource

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Feb 5 19:01:11 PST 2017


Author: christinebao
Date: 2017-02-05 19:01:11 -0800 (Sun, 05 Feb 2017)
New Revision: 9131

Modified:
   sandbox/adsk/3.2o/
   sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.cpp
   sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.h
   sandbox/adsk/3.2o/Server/src/Services/Resource/ApplicationRepositoryManager.cpp
   sandbox/adsk/3.2o/Server/src/Services/Resource/TagManager.cpp
Log:
Merged revision(s) 9130 from trunk/MgDev:
Fix ticket: MapGuide feature source data add supporting for proxy
https://trac.osgeo.org/mapguide/ticket/2761

Add support for proxy resource data. 
........



Property changes on: sandbox/adsk/3.2o
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/branches/3.1/MgDev:9026,9058-9059,9067-9068
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8869-8871,9106-9107
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/branches/3.1/MgDev:9026,9058-9059,9067-9068
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8869-8871,9106-9107,9130

Modified: sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.cpp
===================================================================
--- sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.cpp	2017-02-06 02:58:45 UTC (rev 9130)
+++ sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.cpp	2017-02-06 03:01:11 UTC (rev 9131)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//  Copyright (C) 2017 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -69,6 +69,10 @@
 const STRING MgResourceTag::LoginPassword           = L"%MG_LOGIN_PASSWORD%";
 const STRING MgResourceTag::Username                = L"%MG_USERNAME%";
 const STRING MgResourceTag::Password                = L"%MG_PASSWORD%";
+const STRING MgResourceTag::ProxyServer             = L"%MG_PROXY_SERVER%";
+const STRING MgResourceTag::ProxyPort               = L"%MG_PROXY_PORT%";
+const STRING MgResourceTag::ProxyUsername           = L"%MG_PROXY_USERNAME%";
+const STRING MgResourceTag::ProxyPassword           = L"%MG_PROXY_PASSWORD%";
 const STRING MgResourceTag::DataFilePath            = L"%MG_DATA_FILE_PATH%";
 const STRING MgResourceTag::TileCachePath           = L"%MG_TILE_CACHE_PATH%";
 const STRING MgResourceTag::DataPathAliasBegin      = L"%MG_DATA_PATH_ALIAS[";
@@ -79,6 +83,9 @@
 /// Resource data names
 ///
 const STRING MgResourceDataName::UserCredentials    = L"MG_USER_CREDENTIALS";
+const STRING MgResourceDataName::ProxyServerName    = L"MG_PROXY_SERVER";
+const STRING MgResourceDataName::ProxyServerPort    = L"MG_PROXY_PORT";
+const STRING MgResourceDataName::ProxyCredentials   = L"MG_PROXY_CREDENTIALS";
 
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.h
===================================================================
--- sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.h	2017-02-06 02:58:45 UTC (rev 9130)
+++ sandbox/adsk/3.2o/Common/PlatformBase/Services/ResourceDefs.h	2017-02-06 03:01:11 UTC (rev 9131)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//  Copyright (C) 2017 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -366,7 +366,30 @@
     ///
     static const STRING Password;       ///\if INTERNAL value("%MG_PASSWORD%") \endif
 
+	////////////////////////////////////////////////////////////////
+	/// \brief
+	/// Replaced with the proxy server name.
+	///
+	static const STRING ProxyServer;       ///\if INTERNAL value("%MG_PROXY_SERVER%") \endif
 
+	////////////////////////////////////////////////////////////////
+	/// \brief
+	/// Replaced with the proxy server port.
+	///
+	static const STRING ProxyPort;       ///\if INTERNAL value("%MG_PROXY_PORT%") \endif
+
+	////////////////////////////////////////////////////////////////
+	/// \brief
+	/// Replaced with the proxy server user name.
+	///
+	static const STRING ProxyUsername;       ///\if INTERNAL value("%MG_PROXY_USERNAME%") \endif
+
+	////////////////////////////////////////////////////////////////
+	/// \brief
+	/// Replaced with the proxy server password.
+	///
+	static const STRING ProxyPassword;       ///\if INTERNAL value("%MG_PROXY_PASSWORD%") \endif
+
     ////////////////////////////////////////////////////////////////
     /// \brief
     /// Replaced with the location of data files associated with the
@@ -404,16 +427,49 @@
 class MG_PLATFORMBASE_API MgResourceDataName
 {
 PUBLISHED_API:
+	/////////////////////////////////////////////////////////////////
+	/// \brief
+	/// Data name for adding default credentials to a resource.
+	///
+	/// \note1
+	///
+	/// \remarks
+	/// For an example, see \link MgResourceService::SetResourceData SetResourceData \endlink.
+	///
+	static const STRING UserCredentials;    ///\if INTERNAL value("MG_USER_CREDENTIALS") \endif
+
     /////////////////////////////////////////////////////////////////
     /// \brief
-    /// Data name for adding default credentials to a resource.
+    /// Data name for adding proxy server name to a resource.
     ///
     /// \note1
     ///
     /// \remarks
     /// For an example, see \link MgResourceService::SetResourceData SetResourceData \endlink.
     ///
-    static const STRING UserCredentials;    ///\if INTERNAL value("MG_USER_CREDENTIALS") \endif
+    static const STRING ProxyServerName;    ///\if INTERNAL value("MG_PROXY_SERVER") \endif
+
+    /////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Data name for adding proxy server port to a resource.
+    ///
+    /// \note1
+    ///
+    /// \remarks
+    /// For an example, see \link MgResourceService::SetResourceData SetResourceData \endlink.
+    ///
+	static const STRING ProxyServerPort;    ///\if INTERNAL value("MG_PROXY_PORT") \endif
+
+    /////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Data name for adding proxy credentials to a resource.
+    ///
+    /// \note1
+    ///
+    /// \remarks
+    /// For an example, see \link MgResourceService::SetResourceData SetResourceData \endlink.
+    ///
+	static const STRING ProxyCredentials;    ///\if INTERNAL value("MG_PROXY_CREDENTIALS") \endif
 };
 
 

Modified: sandbox/adsk/3.2o/Server/src/Services/Resource/ApplicationRepositoryManager.cpp
===================================================================
--- sandbox/adsk/3.2o/Server/src/Services/Resource/ApplicationRepositoryManager.cpp	2017-02-06 02:58:45 UTC (rev 9130)
+++ sandbox/adsk/3.2o/Server/src/Services/Resource/ApplicationRepositoryManager.cpp	2017-02-06 03:01:11 UTC (rev 9131)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//  Copyright (C) 2017 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -945,7 +945,7 @@
     {
         dataValue = data->ToString();
 
-        if (MgResourceDataName::UserCredentials == dataName)
+        if (MgResourceDataName::UserCredentials == dataName || MgResourceDataName::ProxyCredentials == dataName)
         {
             MgCryptographyManager cryptoManager;
 
@@ -1221,7 +1221,7 @@
     {
         string data;
 
-        if (MgResourceDataName::UserCredentials == dataName)
+        if (MgResourceDataName::UserCredentials == dataName || MgResourceDataName::ProxyCredentials == dataName)
         {
             // For security purpose, only the decrypted username
             // (no decrypted password) is returned.

Modified: sandbox/adsk/3.2o/Server/src/Services/Resource/TagManager.cpp
===================================================================
--- sandbox/adsk/3.2o/Server/src/Services/Resource/TagManager.cpp	2017-02-06 02:58:45 UTC (rev 9130)
+++ sandbox/adsk/3.2o/Server/src/Services/Resource/TagManager.cpp	2017-02-06 03:01:11 UTC (rev 9131)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//  Copyright (C) 2017 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -175,9 +175,9 @@
     }
 
     if ((MgResourceDataType::String != type
-            && MgResourceDataName::UserCredentials == name)
+            && ((MgResourceDataName::UserCredentials == name) || (MgResourceDataName::ProxyServerName == name) || (MgResourceDataName::ProxyServerPort == name) || (MgResourceDataName::ProxyCredentials == name)))
         || (MgResourceDataType::String == type
-                && MgResourceDataName::UserCredentials != name))
+                && ((MgResourceDataName::UserCredentials != name) && (MgResourceDataName::ProxyServerName != name) && (MgResourceDataName::ProxyServerPort != name) && (MgResourceDataName::ProxyCredentials != name))))
     {
         throw new MgInvalidResourceDataTypeException(
             L"MgTagManager.ValidateTag", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -323,6 +323,46 @@
         MG_CRYPTOGRAPHY_CATCH_AND_THROW(L"MgTagManager.SubstituteTags")
     }
 
+	if (GetTag(MgResourceDataName::ProxyServerName, tagInfo, false))
+	{
+		CREFSTRING proxyServer = tagInfo.GetAttribute(MgTagInfo::TokenValue);
+		count += MgUtil::ReplaceString(
+            MgUtil::WideCharToMultiByte(MgResourceTag::ProxyServer),
+			MgUtil::WideCharToMultiByte(proxyServer),
+            doc, -1);
+	}
+
+    if (GetTag(MgResourceDataName::ProxyServerPort, tagInfo, false))
+    {
+        CREFSTRING proxyPort = tagInfo.GetAttribute(MgTagInfo::TokenValue);
+        count += MgUtil::ReplaceString(
+            MgUtil::WideCharToMultiByte(MgResourceTag::ProxyPort),
+            MgUtil::WideCharToMultiByte(proxyPort),
+            doc, -1);
+    }
+
+    if (GetTag(MgResourceDataName::ProxyCredentials, tagInfo, false))
+    {
+        MG_CRYPTOGRAPHY_TRY()
+
+            MgCryptographyUtil cryptoUtil;
+        string proxyUsername, proxyPassword;
+
+        cryptoUtil.DecryptCredentials(MgUtil::WideCharToMultiByte(
+            tagInfo.GetAttribute(MgTagInfo::TokenValue)), proxyUsername, proxyPassword);
+
+        count += MgUtil::ReplaceString(
+            MgUtil::WideCharToMultiByte(MgResourceTag::ProxyUsername),
+            proxyUsername,
+            doc, -1);
+        count += MgUtil::ReplaceString(
+            MgUtil::WideCharToMultiByte(MgResourceTag::ProxyPassword),
+            proxyPassword,
+            doc, -1);
+
+        MG_CRYPTOGRAPHY_CATCH_AND_THROW(L"MgTagManager.SubstituteTags")
+    }
+
     count += MgUtil::ReplaceString(
         MgUtil::WideCharToMultiByte(MgResourceTag::LoginUsername),
         MgUtil::WideCharToMultiByte(dataBindingInfo.GetLoginUsername()),



More information about the mapguide-commits mailing list