This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								CASA-auth-token/non-java/TestClientAuth/App.ico
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								CASA-auth-token/non-java/TestClientAuth/App.ico
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.1 KiB | 
							
								
								
									
										58
									
								
								CASA-auth-token/non-java/TestClientAuth/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								CASA-auth-token/non-java/TestClientAuth/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | |||||||
|  | using System.Reflection; | ||||||
|  | using System.Runtime.CompilerServices; | ||||||
|  |  | ||||||
|  | // | ||||||
|  | // General Information about an assembly is controlled through the following  | ||||||
|  | // set of attributes. Change these attribute values to modify the information | ||||||
|  | // associated with an assembly. | ||||||
|  | // | ||||||
|  | [assembly: AssemblyTitle("")] | ||||||
|  | [assembly: AssemblyDescription("")] | ||||||
|  | [assembly: AssemblyConfiguration("")] | ||||||
|  | [assembly: AssemblyCompany("")] | ||||||
|  | [assembly: AssemblyProduct("")] | ||||||
|  | [assembly: AssemblyCopyright("")] | ||||||
|  | [assembly: AssemblyTrademark("")] | ||||||
|  | [assembly: AssemblyCulture("")]		 | ||||||
|  |  | ||||||
|  | // | ||||||
|  | // Version information for an assembly consists of the following four values: | ||||||
|  | // | ||||||
|  | //      Major Version | ||||||
|  | //      Minor Version  | ||||||
|  | //      Build Number | ||||||
|  | //      Revision | ||||||
|  | // | ||||||
|  | // You can specify all the values or you can default the Revision and Build Numbers  | ||||||
|  | // by using the '*' as shown below: | ||||||
|  |  | ||||||
|  | [assembly: AssemblyVersion("1.0.*")] | ||||||
|  |  | ||||||
|  | // | ||||||
|  | // In order to sign your assembly you must specify a key to use. Refer to the  | ||||||
|  | // Microsoft .NET Framework documentation for more information on assembly signing. | ||||||
|  | // | ||||||
|  | // Use the attributes below to control which key is used for signing.  | ||||||
|  | // | ||||||
|  | // Notes:  | ||||||
|  | //   (*) If no key is specified, the assembly is not signed. | ||||||
|  | //   (*) KeyName refers to a key that has been installed in the Crypto Service | ||||||
|  | //       Provider (CSP) on your machine. KeyFile refers to a file which contains | ||||||
|  | //       a key. | ||||||
|  | //   (*) If the KeyFile and the KeyName values are both specified, the  | ||||||
|  | //       following processing occurs: | ||||||
|  | //       (1) If the KeyName can be found in the CSP, that key is used. | ||||||
|  | //       (2) If the KeyName does not exist and the KeyFile does exist, the key  | ||||||
|  | //           in the KeyFile is installed into the CSP and used. | ||||||
|  | //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. | ||||||
|  | //       When specifying the KeyFile, the location of the KeyFile should be | ||||||
|  | //       relative to the project output directory which is | ||||||
|  | //       %Project Directory%\obj\<configuration>. For example, if your KeyFile is | ||||||
|  | //       located in the project directory, you would specify the AssemblyKeyFile  | ||||||
|  | //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] | ||||||
|  | //   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework | ||||||
|  | //       documentation for more information on this. | ||||||
|  | // | ||||||
|  | [assembly: AssemblyDelaySign(false)] | ||||||
|  | [assembly: AssemblyKeyFile("")] | ||||||
|  | [assembly: AssemblyKeyName("")] | ||||||
							
								
								
									
										46
									
								
								CASA-auth-token/non-java/TestClientAuth/Class1.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								CASA-auth-token/non-java/TestClientAuth/Class1.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  | using System; | ||||||
|  | using Novell.Casa.Client.Auth; | ||||||
|  |  | ||||||
|  | namespace TestClientAuth | ||||||
|  | { | ||||||
|  | 	/// <summary> | ||||||
|  | 	/// Summary description for Class1. | ||||||
|  | 	/// </summary> | ||||||
|  | 	class Class1 | ||||||
|  | 	{ | ||||||
|  | 		/// <summary> | ||||||
|  | 		/// The main entry point for the application. | ||||||
|  | 		/// </summary> | ||||||
|  | 		[STAThread] | ||||||
|  | 		static void Main(string[] args) | ||||||
|  | 		{ | ||||||
|  | 			if (args.Length < 1) | ||||||
|  | 			{ | ||||||
|  | 				Console.WriteLine("Usage: TestClientAuth [server]"); | ||||||
|  | 				Console.WriteLine("Press enter to continue"); | ||||||
|  | 				Console.ReadLine(); | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			try | ||||||
|  | 			{ | ||||||
|  | 				byte[] baToken = Authtoken.ObtainAuthToken("testService", args[0]); | ||||||
|  | 				Console.WriteLine("Token returned:"); | ||||||
|  | 				for (int i=0; i<baToken.Length; i++) | ||||||
|  | 				{ | ||||||
|  | 					Console.Write(baToken[i].ToString()); | ||||||
|  | 				} | ||||||
|  | 				Console.WriteLine(""); | ||||||
|  | 				Console.WriteLine("Press enter to continue"); | ||||||
|  | 				Console.ReadLine(); | ||||||
|  | 			} | ||||||
|  | 			catch (Exception e) | ||||||
|  | 			{ | ||||||
|  | 				Console.WriteLine(e.ToString()); | ||||||
|  | 				Console.WriteLine(""); | ||||||
|  | 				Console.WriteLine("Press enter to continue"); | ||||||
|  | 				Console.ReadLine(); | ||||||
|  | 			}			 | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										109
									
								
								CASA-auth-token/non-java/TestClientAuth/TestClientAuth.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								CASA-auth-token/non-java/TestClientAuth/TestClientAuth.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | |||||||
|  | <VisualStudioProject> | ||||||
|  |     <CSHARP | ||||||
|  |         ProjectType = "Local" | ||||||
|  |         ProductVersion = "7.10.3077" | ||||||
|  |         SchemaVersion = "2.0" | ||||||
|  |         ProjectGuid = "{0EA635EA-97F2-4950-B36B-8151ED858DA4}" | ||||||
|  |     > | ||||||
|  |         <Build> | ||||||
|  |             <Settings | ||||||
|  |                 ApplicationIcon = "App.ico" | ||||||
|  |                 AssemblyKeyContainerName = "" | ||||||
|  |                 AssemblyName = "TestClientAuth" | ||||||
|  |                 AssemblyOriginatorKeyFile = "" | ||||||
|  |                 DefaultClientScript = "JScript" | ||||||
|  |                 DefaultHTMLPageLayout = "Grid" | ||||||
|  |                 DefaultTargetSchema = "IE50" | ||||||
|  |                 DelaySign = "false" | ||||||
|  |                 OutputType = "Exe" | ||||||
|  |                 PreBuildEvent = "" | ||||||
|  |                 PostBuildEvent = "" | ||||||
|  |                 RootNamespace = "TestClientAuth" | ||||||
|  |                 RunPostBuildEvent = "OnBuildSuccess" | ||||||
|  |                 StartupObject = "" | ||||||
|  |             > | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Debug" | ||||||
|  |                     AllowUnsafeBlocks = "false" | ||||||
|  |                     BaseAddress = "285212672" | ||||||
|  |                     CheckForOverflowUnderflow = "false" | ||||||
|  |                     ConfigurationOverrideFile = "" | ||||||
|  |                     DefineConstants = "DEBUG;TRACE" | ||||||
|  |                     DocumentationFile = "" | ||||||
|  |                     DebugSymbols = "true" | ||||||
|  |                     FileAlignment = "4096" | ||||||
|  |                     IncrementalBuild = "false" | ||||||
|  |                     NoStdLib = "false" | ||||||
|  |                     NoWarn = "" | ||||||
|  |                     Optimize = "false" | ||||||
|  |                     OutputPath = "bin\Debug\" | ||||||
|  |                     RegisterForComInterop = "false" | ||||||
|  |                     RemoveIntegerChecks = "false" | ||||||
|  |                     TreatWarningsAsErrors = "false" | ||||||
|  |                     WarningLevel = "4" | ||||||
|  |                 /> | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Release" | ||||||
|  |                     AllowUnsafeBlocks = "false" | ||||||
|  |                     BaseAddress = "285212672" | ||||||
|  |                     CheckForOverflowUnderflow = "false" | ||||||
|  |                     ConfigurationOverrideFile = "" | ||||||
|  |                     DefineConstants = "TRACE" | ||||||
|  |                     DocumentationFile = "" | ||||||
|  |                     DebugSymbols = "false" | ||||||
|  |                     FileAlignment = "4096" | ||||||
|  |                     IncrementalBuild = "false" | ||||||
|  |                     NoStdLib = "false" | ||||||
|  |                     NoWarn = "" | ||||||
|  |                     Optimize = "true" | ||||||
|  |                     OutputPath = "bin\Release\" | ||||||
|  |                     RegisterForComInterop = "false" | ||||||
|  |                     RemoveIntegerChecks = "false" | ||||||
|  |                     TreatWarningsAsErrors = "false" | ||||||
|  |                     WarningLevel = "4" | ||||||
|  |                 /> | ||||||
|  |             </Settings> | ||||||
|  |             <References> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "System" | ||||||
|  |                     AssemblyName = "System" | ||||||
|  |                     HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" | ||||||
|  |                 /> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "System.Data" | ||||||
|  |                     AssemblyName = "System.Data" | ||||||
|  |                     HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" | ||||||
|  |                 /> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "System.XML" | ||||||
|  |                     AssemblyName = "System.XML" | ||||||
|  |                     HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" | ||||||
|  |                 /> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "Novell.Casa.Client" | ||||||
|  |                     Project = "{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}" | ||||||
|  |                     Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" | ||||||
|  |                 /> | ||||||
|  |             </References> | ||||||
|  |         </Build> | ||||||
|  |         <Files> | ||||||
|  |             <Include> | ||||||
|  |                 <File | ||||||
|  |                     RelPath = "App.ico" | ||||||
|  |                     BuildAction = "Content" | ||||||
|  |                 /> | ||||||
|  |                 <File | ||||||
|  |                     RelPath = "AssemblyInfo.cs" | ||||||
|  |                     SubType = "Code" | ||||||
|  |                     BuildAction = "Compile" | ||||||
|  |                 /> | ||||||
|  |                 <File | ||||||
|  |                     RelPath = "Class1.cs" | ||||||
|  |                     SubType = "Code" | ||||||
|  |                     BuildAction = "Compile" | ||||||
|  |                 /> | ||||||
|  |             </Include> | ||||||
|  |         </Files> | ||||||
|  |     </CSHARP> | ||||||
|  | </VisualStudioProject> | ||||||
|  |  | ||||||
| @@ -0,0 +1,48 @@ | |||||||
|  | <VisualStudioProject> | ||||||
|  |     <CSHARP LastOpenVersion = "7.10.3077" > | ||||||
|  |         <Build> | ||||||
|  |             <Settings ReferencePath = "" > | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Debug" | ||||||
|  |                     EnableASPDebugging = "false" | ||||||
|  |                     EnableASPXDebugging = "false" | ||||||
|  |                     EnableUnmanagedDebugging = "false" | ||||||
|  |                     EnableSQLServerDebugging = "false" | ||||||
|  |                     RemoteDebugEnabled = "false" | ||||||
|  |                     RemoteDebugMachine = "" | ||||||
|  |                     StartAction = "Project" | ||||||
|  |                     StartArguments = "jcserver2.provo.novell.com" | ||||||
|  |                     StartPage = "" | ||||||
|  |                     StartProgram = "" | ||||||
|  |                     StartURL = "" | ||||||
|  |                     StartWorkingDirectory = "" | ||||||
|  |                     StartWithIE = "true" | ||||||
|  |                 /> | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Release" | ||||||
|  |                     EnableASPDebugging = "false" | ||||||
|  |                     EnableASPXDebugging = "false" | ||||||
|  |                     EnableUnmanagedDebugging = "false" | ||||||
|  |                     EnableSQLServerDebugging = "false" | ||||||
|  |                     RemoteDebugEnabled = "false" | ||||||
|  |                     RemoteDebugMachine = "" | ||||||
|  |                     StartAction = "Project" | ||||||
|  |                     StartArguments = "137.65.123.123" | ||||||
|  |                     StartPage = "" | ||||||
|  |                     StartProgram = "" | ||||||
|  |                     StartURL = "" | ||||||
|  |                     StartWorkingDirectory = "" | ||||||
|  |                     StartWithIE = "true" | ||||||
|  |                 /> | ||||||
|  |             </Settings> | ||||||
|  |         </Build> | ||||||
|  |         <OtherProjectSettings | ||||||
|  |             CopyProjectDestinationFolder = "" | ||||||
|  |             CopyProjectUncPath = "" | ||||||
|  |             CopyProjectOption = "0" | ||||||
|  |             ProjectView = "ProjectFiles" | ||||||
|  |             ProjectTrust = "0" | ||||||
|  |         /> | ||||||
|  |     </CSHARP> | ||||||
|  | </VisualStudioProject> | ||||||
|  |  | ||||||
| @@ -24,6 +24,14 @@ Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "authtokenclient_msi", "clie | |||||||
| 	ProjectSection(ProjectDependencies) = postProject | 	ProjectSection(ProjectDependencies) = postProject | ||||||
| 	EndProjectSection | 	EndProjectSection | ||||||
| EndProject | EndProject | ||||||
|  | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novell.Casa.Client", "client\csharp\Novell.Casa.Authtoken\Novell.Casa.Client.csproj", "{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}" | ||||||
|  | 	ProjectSection(ProjectDependencies) = postProject | ||||||
|  | 	EndProjectSection | ||||||
|  | EndProject | ||||||
|  | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClientAuth", "TestClientAuth\TestClientAuth.csproj", "{0EA635EA-97F2-4950-B36B-8151ED858DA4}" | ||||||
|  | 	ProjectSection(ProjectDependencies) = postProject | ||||||
|  | 	EndProjectSection | ||||||
|  | EndProject | ||||||
| Global | Global | ||||||
| 	GlobalSection(SolutionConfiguration) = preSolution | 	GlobalSection(SolutionConfiguration) = preSolution | ||||||
| 		Debug = Debug | 		Debug = Debug | ||||||
| @@ -52,6 +60,14 @@ Global | |||||||
| 		{70ED319E-F496-4F07-878C-1921426DD399}.Release.Build.0 = Release | 		{70ED319E-F496-4F07-878C-1921426DD399}.Release.Build.0 = Release | ||||||
| 		{AA014EB3-8AD3-49B8-92E3-F8AA0FBCEE9B}.Debug.ActiveCfg = Debug | 		{AA014EB3-8AD3-49B8-92E3-F8AA0FBCEE9B}.Debug.ActiveCfg = Debug | ||||||
| 		{AA014EB3-8AD3-49B8-92E3-F8AA0FBCEE9B}.Release.ActiveCfg = Release | 		{AA014EB3-8AD3-49B8-92E3-F8AA0FBCEE9B}.Release.ActiveCfg = Release | ||||||
|  | 		{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}.Debug.ActiveCfg = Debug|.NET | ||||||
|  | 		{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}.Debug.Build.0 = Debug|.NET | ||||||
|  | 		{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}.Release.ActiveCfg = Release|.NET | ||||||
|  | 		{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}.Release.Build.0 = Release|.NET | ||||||
|  | 		{0EA635EA-97F2-4950-B36B-8151ED858DA4}.Debug.ActiveCfg = Debug|.NET | ||||||
|  | 		{0EA635EA-97F2-4950-B36B-8151ED858DA4}.Debug.Build.0 = Debug|.NET | ||||||
|  | 		{0EA635EA-97F2-4950-B36B-8151ED858DA4}.Release.ActiveCfg = Release|.NET | ||||||
|  | 		{0EA635EA-97F2-4950-B36B-8151ED858DA4}.Release.Build.0 = Release|.NET | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
|   | |||||||
| @@ -0,0 +1,58 @@ | |||||||
|  | using System.Reflection; | ||||||
|  | using System.Runtime.CompilerServices; | ||||||
|  |  | ||||||
|  | // | ||||||
|  | // General Information about an assembly is controlled through the following  | ||||||
|  | // set of attributes. Change these attribute values to modify the information | ||||||
|  | // associated with an assembly. | ||||||
|  | // | ||||||
|  | [assembly: AssemblyTitle("")] | ||||||
|  | [assembly: AssemblyDescription("")] | ||||||
|  | [assembly: AssemblyConfiguration("")] | ||||||
|  | [assembly: AssemblyCompany("")] | ||||||
|  | [assembly: AssemblyProduct("")] | ||||||
|  | [assembly: AssemblyCopyright("")] | ||||||
|  | [assembly: AssemblyTrademark("")] | ||||||
|  | [assembly: AssemblyCulture("")]		 | ||||||
|  |  | ||||||
|  | // | ||||||
|  | // Version information for an assembly consists of the following four values: | ||||||
|  | // | ||||||
|  | //      Major Version | ||||||
|  | //      Minor Version  | ||||||
|  | //      Build Number | ||||||
|  | //      Revision | ||||||
|  | // | ||||||
|  | // You can specify all the values or you can default the Revision and Build Numbers  | ||||||
|  | // by using the '*' as shown below: | ||||||
|  |  | ||||||
|  | [assembly: AssemblyVersion("1.0.*")] | ||||||
|  |  | ||||||
|  | // | ||||||
|  | // In order to sign your assembly you must specify a key to use. Refer to the  | ||||||
|  | // Microsoft .NET Framework documentation for more information on assembly signing. | ||||||
|  | // | ||||||
|  | // Use the attributes below to control which key is used for signing.  | ||||||
|  | // | ||||||
|  | // Notes:  | ||||||
|  | //   (*) If no key is specified, the assembly is not signed. | ||||||
|  | //   (*) KeyName refers to a key that has been installed in the Crypto Service | ||||||
|  | //       Provider (CSP) on your machine. KeyFile refers to a file which contains | ||||||
|  | //       a key. | ||||||
|  | //   (*) If the KeyFile and the KeyName values are both specified, the  | ||||||
|  | //       following processing occurs: | ||||||
|  | //       (1) If the KeyName can be found in the CSP, that key is used. | ||||||
|  | //       (2) If the KeyName does not exist and the KeyFile does exist, the key  | ||||||
|  | //           in the KeyFile is installed into the CSP and used. | ||||||
|  | //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. | ||||||
|  | //       When specifying the KeyFile, the location of the KeyFile should be | ||||||
|  | //       relative to the project output directory which is | ||||||
|  | //       %Project Directory%\obj\<configuration>. For example, if your KeyFile is | ||||||
|  | //       located in the project directory, you would specify the AssemblyKeyFile  | ||||||
|  | //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] | ||||||
|  | //   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework | ||||||
|  | //       documentation for more information on this. | ||||||
|  | // | ||||||
|  | [assembly: AssemblyDelaySign(false)] | ||||||
|  | [assembly: AssemblyKeyFile("")] | ||||||
|  | [assembly: AssemblyKeyName("")] | ||||||
| @@ -0,0 +1,100 @@ | |||||||
|  | using System; | ||||||
|  | using System.Text; | ||||||
|  | using System.Runtime.InteropServices; | ||||||
|  |  | ||||||
|  | namespace Novell.Casa.Client.Auth | ||||||
|  | { | ||||||
|  | 	/// <summary> | ||||||
|  | 	/// Summary description for Class1. | ||||||
|  | 	/// </summary> | ||||||
|  | 	public class Authtoken | ||||||
|  | 	{ | ||||||
|  | 		private const string AUTH_LIBRARY = "C:\\Program Files\\Novell\\CASA\\lib\\authtoken"; | ||||||
|  |  | ||||||
|  | 		[DllImport(AUTH_LIBRARY, CharSet=CharSet.None) ] | ||||||
|  | 		public static extern int ObtainAuthToken | ||||||
|  | 			( | ||||||
|  | 				[In]		byte[] 			baService,		 | ||||||
|  | 				[In]		byte[]  		baHost, | ||||||
|  | 							IntPtr			pToken,				 | ||||||
|  | 				[In, Out]	ref int 		iTokenLength								 | ||||||
|  | 			); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 		public Authtoken() | ||||||
|  | 		{ | ||||||
|  | 			// | ||||||
|  | 			// TODO: Add constructor logic here | ||||||
|  | 			// | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 		public static byte[] ObtainAuthToken(string sService, string sHost) | ||||||
|  | 		{ | ||||||
|  | 			int rcode = 0; | ||||||
|  | 			byte[] baService = null; | ||||||
|  | 			byte[] baHost =  null; | ||||||
|  | 			 | ||||||
|  | 			int bufferSize = 4096; | ||||||
|  | 			IntPtr pBuffer = Marshal.AllocHGlobal(bufferSize); | ||||||
|  |  | ||||||
|  | 			byte[] baToken = new byte[bufferSize]; | ||||||
|  |  | ||||||
|  | 			// convert service to ascii byte array | ||||||
|  | 			if (sService != null) | ||||||
|  | 			{ | ||||||
|  | 				baService = Encoding.ASCII.GetBytes(sService); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				throw new Exception("Invalid parameter"); | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			// convert host to ascii byte array | ||||||
|  | 			if (sHost != null) | ||||||
|  | 			{ | ||||||
|  | 				baHost = Encoding.ASCII.GetBytes(sHost); | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			LogMessage("Calling Native API->ObtainAuthToken"); | ||||||
|  | 			LogMessage("Buffer size is "+ bufferSize); | ||||||
|  |  | ||||||
|  | 			try | ||||||
|  | 			{ | ||||||
|  | 				rcode = ObtainAuthToken(baService, baHost, pBuffer, ref bufferSize);						 | ||||||
|  | 			} | ||||||
|  | 			catch (Exception e) | ||||||
|  | 			{ | ||||||
|  | 				LogMessage(e.ToString()); | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
|  | 			LogMessage("ObtainAuthToken returned " + rcode); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 			if (rcode != 0) | ||||||
|  | 			{ | ||||||
|  | 				Marshal.FreeHGlobal(pBuffer); | ||||||
|  | 				throw new Exception(rcode.ToString()); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				// marshal the IntPtr into a byte array | ||||||
|  | 				String sTemp = Marshal.PtrToStringAnsi(pBuffer, bufferSize); | ||||||
|  | 				Marshal.FreeHGlobal(pBuffer); | ||||||
|  | 				return (Encoding.ASCII.GetBytes(sTemp)); | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			return null; | ||||||
|  | 			 | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 		private static void LogMessage(string sMessage) | ||||||
|  | 		{ | ||||||
|  | 			System.Diagnostics.Trace.WriteLine("(C#)AuthToken: " + sMessage); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,100 @@ | |||||||
|  | <VisualStudioProject> | ||||||
|  |     <CSHARP | ||||||
|  |         ProjectType = "Local" | ||||||
|  |         ProductVersion = "7.10.3077" | ||||||
|  |         SchemaVersion = "2.0" | ||||||
|  |         ProjectGuid = "{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}" | ||||||
|  |     > | ||||||
|  |         <Build> | ||||||
|  |             <Settings | ||||||
|  |                 ApplicationIcon = "" | ||||||
|  |                 AssemblyKeyContainerName = "" | ||||||
|  |                 AssemblyName = "Novell.Casa.Client.Auth" | ||||||
|  |                 AssemblyOriginatorKeyFile = "" | ||||||
|  |                 DefaultClientScript = "JScript" | ||||||
|  |                 DefaultHTMLPageLayout = "Grid" | ||||||
|  |                 DefaultTargetSchema = "IE50" | ||||||
|  |                 DelaySign = "false" | ||||||
|  |                 OutputType = "Library" | ||||||
|  |                 PreBuildEvent = "" | ||||||
|  |                 PostBuildEvent = "" | ||||||
|  |                 RootNamespace = "Novell.Casa.Client.Auth" | ||||||
|  |                 RunPostBuildEvent = "OnBuildSuccess" | ||||||
|  |                 StartupObject = "" | ||||||
|  |             > | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Debug" | ||||||
|  |                     AllowUnsafeBlocks = "false" | ||||||
|  |                     BaseAddress = "285212672" | ||||||
|  |                     CheckForOverflowUnderflow = "false" | ||||||
|  |                     ConfigurationOverrideFile = "" | ||||||
|  |                     DefineConstants = "DEBUG;TRACE" | ||||||
|  |                     DocumentationFile = "" | ||||||
|  |                     DebugSymbols = "true" | ||||||
|  |                     FileAlignment = "4096" | ||||||
|  |                     IncrementalBuild = "false" | ||||||
|  |                     NoStdLib = "false" | ||||||
|  |                     NoWarn = "" | ||||||
|  |                     Optimize = "false" | ||||||
|  |                     OutputPath = "bin\Debug\" | ||||||
|  |                     RegisterForComInterop = "false" | ||||||
|  |                     RemoveIntegerChecks = "false" | ||||||
|  |                     TreatWarningsAsErrors = "false" | ||||||
|  |                     WarningLevel = "4" | ||||||
|  |                 /> | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Release" | ||||||
|  |                     AllowUnsafeBlocks = "false" | ||||||
|  |                     BaseAddress = "285212672" | ||||||
|  |                     CheckForOverflowUnderflow = "false" | ||||||
|  |                     ConfigurationOverrideFile = "" | ||||||
|  |                     DefineConstants = "TRACE" | ||||||
|  |                     DocumentationFile = "" | ||||||
|  |                     DebugSymbols = "false" | ||||||
|  |                     FileAlignment = "4096" | ||||||
|  |                     IncrementalBuild = "false" | ||||||
|  |                     NoStdLib = "false" | ||||||
|  |                     NoWarn = "" | ||||||
|  |                     Optimize = "true" | ||||||
|  |                     OutputPath = "bin\Release\" | ||||||
|  |                     RegisterForComInterop = "false" | ||||||
|  |                     RemoveIntegerChecks = "false" | ||||||
|  |                     TreatWarningsAsErrors = "false" | ||||||
|  |                     WarningLevel = "4" | ||||||
|  |                 /> | ||||||
|  |             </Settings> | ||||||
|  |             <References> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "System" | ||||||
|  |                     AssemblyName = "System" | ||||||
|  |                     HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" | ||||||
|  |                 /> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "System.Data" | ||||||
|  |                     AssemblyName = "System.Data" | ||||||
|  |                     HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" | ||||||
|  |                 /> | ||||||
|  |                 <Reference | ||||||
|  |                     Name = "System.XML" | ||||||
|  |                     AssemblyName = "System.XML" | ||||||
|  |                     HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" | ||||||
|  |                 /> | ||||||
|  |             </References> | ||||||
|  |         </Build> | ||||||
|  |         <Files> | ||||||
|  |             <Include> | ||||||
|  |                 <File | ||||||
|  |                     RelPath = "AssemblyInfo.cs" | ||||||
|  |                     SubType = "Code" | ||||||
|  |                     BuildAction = "Compile" | ||||||
|  |                 /> | ||||||
|  |                 <File | ||||||
|  |                     RelPath = "Authtoken.cs" | ||||||
|  |                     SubType = "Code" | ||||||
|  |                     BuildAction = "Compile" | ||||||
|  |                 /> | ||||||
|  |             </Include> | ||||||
|  |         </Files> | ||||||
|  |     </CSHARP> | ||||||
|  | </VisualStudioProject> | ||||||
|  |  | ||||||
| @@ -0,0 +1,48 @@ | |||||||
|  | <VisualStudioProject> | ||||||
|  |     <CSHARP LastOpenVersion = "7.10.3077" > | ||||||
|  |         <Build> | ||||||
|  |             <Settings ReferencePath = "" > | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Debug" | ||||||
|  |                     EnableASPDebugging = "false" | ||||||
|  |                     EnableASPXDebugging = "false" | ||||||
|  |                     EnableUnmanagedDebugging = "false" | ||||||
|  |                     EnableSQLServerDebugging = "false" | ||||||
|  |                     RemoteDebugEnabled = "false" | ||||||
|  |                     RemoteDebugMachine = "" | ||||||
|  |                     StartAction = "Project" | ||||||
|  |                     StartArguments = "" | ||||||
|  |                     StartPage = "" | ||||||
|  |                     StartProgram = "" | ||||||
|  |                     StartURL = "" | ||||||
|  |                     StartWorkingDirectory = "" | ||||||
|  |                     StartWithIE = "true" | ||||||
|  |                 /> | ||||||
|  |                 <Config | ||||||
|  |                     Name = "Release" | ||||||
|  |                     EnableASPDebugging = "false" | ||||||
|  |                     EnableASPXDebugging = "false" | ||||||
|  |                     EnableUnmanagedDebugging = "false" | ||||||
|  |                     EnableSQLServerDebugging = "false" | ||||||
|  |                     RemoteDebugEnabled = "false" | ||||||
|  |                     RemoteDebugMachine = "" | ||||||
|  |                     StartAction = "Project" | ||||||
|  |                     StartArguments = "" | ||||||
|  |                     StartPage = "" | ||||||
|  |                     StartProgram = "" | ||||||
|  |                     StartURL = "" | ||||||
|  |                     StartWorkingDirectory = "" | ||||||
|  |                     StartWithIE = "true" | ||||||
|  |                 /> | ||||||
|  |             </Settings> | ||||||
|  |         </Build> | ||||||
|  |         <OtherProjectSettings | ||||||
|  |             CopyProjectDestinationFolder = "" | ||||||
|  |             CopyProjectUncPath = "" | ||||||
|  |             CopyProjectOption = "0" | ||||||
|  |             ProjectView = "ProjectFiles" | ||||||
|  |             ProjectTrust = "0" | ||||||
|  |         /> | ||||||
|  |     </CSHARP> | ||||||
|  | </VisualStudioProject> | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user