Commit 1a1ff77a authored by Marvin S. Addison's avatar Marvin S. Addison
Browse files

Add ED-Lite sample.


git-svn-id: https://svn.middleware.vt.edu/svn/ed/edsamples@10064 fa4a4108-76f2-0310-9f0d-ba9fffaf4ff6
parent eaee8520
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{43052D7A-372D-4223-84F2-6855699A26F2}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EdLiteTest</RootNamespace>
<AssemblyName>EdLiteTest</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.DirectoryServices.Protocols" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EdCommon\EdCommon.csproj">
<Project>{88836A16-D3D0-4453-95C8-4ACC8DA91D18}</Project>
<Name>EdCommon</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
using System;
using System.Security.Cryptography.X509Certificates;
using System.DirectoryServices.Protocols;
using EdCommon;
namespace EdLiteTest
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("USAGE: EdLiteTest query");
return;
}
string ldapQuery = args[0];
string ldapHost = EdConstants.ED_LITE;
int ldapPort = 389;
Console.WriteLine(string.Format("Querying {0} for {1}", ldapHost, ldapQuery));
// Create connection and perform anonymous query
LdapConnection conn = null;
try
{
conn = new LdapConnection(
new LdapDirectoryIdentifier(ldapHost, ldapPort),
null,
AuthType.Anonymous);
// VT Enterprise Directory requires LDAPv3
conn.SessionOptions.ProtocolVersion = 3;
conn.Bind();
// Query for authId (i.e. PID) and name parts
// Suppressed entries/attributes not available in ED-Lite
SearchResponse response = (SearchResponse)conn.SendRequest(
new SearchRequest(EdConstants.SEARCH_BASE, ldapQuery, SearchScope.Subtree,
"authId", "givenName", "middleName", "sn"));
// Print attributes of result entries
Console.WriteLine();
Console.WriteLine(response.Entries.Count + " entries found:");
foreach (SearchResultEntry entry in response.Entries)
{
Console.WriteLine(" " + entry.DistinguishedName);
foreach (String name in entry.Attributes.AttributeNames)
{
Console.Write(" " + name + "=");
int n = 0;
foreach (object value in entry.Attributes[name].GetValues(typeof(string)))
{
if (n++ > 0)
{
Console.Write(',');
}
Console.Write(value);
}
Console.WriteLine();
}
}
}
catch (Exception e)
{
Console.WriteLine("Application error: \n" + e);
}
finally
{
if (conn != null)
{
conn.Dispose();
}
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("EdLiteTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdLiteTest")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0e8457db-d8c2-46ce-b0d0-ea2a9de1e8e0")]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
......@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdCommon", "EdCommon\EdComm
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdAuthTest", "EdAuthTest\EdAuthTest.csproj", "{48DAE2D6-E71F-4A49-B2DC-1D5AFA80AD3C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdLiteTest", "EdLiteTest\EdLiteTest.csproj", "{43052D7A-372D-4223-84F2-6855699A26F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -25,6 +27,10 @@ Global
{48DAE2D6-E71F-4A49-B2DC-1D5AFA80AD3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48DAE2D6-E71F-4A49-B2DC-1D5AFA80AD3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48DAE2D6-E71F-4A49-B2DC-1D5AFA80AD3C}.Release|Any CPU.Build.0 = Release|Any CPU
{43052D7A-372D-4223-84F2-6855699A26F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43052D7A-372D-4223-84F2-6855699A26F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43052D7A-372D-4223-84F2-6855699A26F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43052D7A-372D-4223-84F2-6855699A26F2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment