Added flush AuthToken cache API.
This commit is contained in:
@@ -70,6 +70,12 @@ namespace Novell.Casa.Client.Auth
|
||||
[In] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(AUTH_LIBRARY, CharSet = CharSet.None)]
|
||||
private static extern int CleanUpAuthTokenCacheEx
|
||||
(
|
||||
[In] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
|
||||
public Authtoken()
|
||||
{
|
||||
@@ -94,7 +100,7 @@ namespace Novell.Casa.Client.Auth
|
||||
return ObtainAuthToken(sService, sHost, null);
|
||||
}
|
||||
|
||||
private static byte[] ObtainAuthToken(string sService, string sHost, WinLuid luid)
|
||||
public static byte[] ObtainAuthToken(string sService, string sHost, WinLuid luid)
|
||||
{
|
||||
int rcode = 0;
|
||||
byte[] baService = null;
|
||||
@@ -189,6 +195,54 @@ namespace Novell.Casa.Client.Auth
|
||||
}
|
||||
}
|
||||
|
||||
public static void CleanUpAuthTokenCache(WinLuid luid)
|
||||
{
|
||||
SSCS_EXT_T ext = new SSCS_EXT_T();
|
||||
LUID sluid;
|
||||
bool bLuidPassedIn = false;
|
||||
|
||||
if ((luid != null) &&
|
||||
((luid.GetHighPart() != 0) || (luid.GetLowPart() != 0)))
|
||||
{
|
||||
// allocate a structure to marshal
|
||||
sluid = new LUID();
|
||||
sluid.luidHigh = luid.GetHighPart();
|
||||
sluid.luidLow = luid.GetLowPart();
|
||||
|
||||
ext.extID = 1;
|
||||
ext.version = 1;
|
||||
ext.ext = Marshal.AllocHGlobal(Marshal.SizeOf(sluid));
|
||||
|
||||
Marshal.StructureToPtr(sluid, ext.ext, false);
|
||||
bLuidPassedIn = true;
|
||||
}
|
||||
|
||||
// Do the call
|
||||
try
|
||||
{
|
||||
if (bLuidPassedIn)
|
||||
{
|
||||
CleanUpAuthTokenCacheEx(ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
CleanUpAuthTokenCacheEx(null);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogMessage(e.ToString());
|
||||
}
|
||||
|
||||
if (ext.ext != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal(ext.ext);
|
||||
}
|
||||
|
||||
public static void CleanUpAuthTokenCache()
|
||||
{
|
||||
CleanUpAuthTokenCache(null);
|
||||
}
|
||||
|
||||
private static void LogMessage(string sMessage)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("(C#)AuthToken: " + sMessage);
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace TestClientAuth
|
||||
try
|
||||
{
|
||||
|
||||
WinLuid luid = new WinLuid(1234, 5678);
|
||||
Authtoken.ObtainAuthToken("testService", args[0], luid);
|
||||
//WinLuid luid = new WinLuid(1234, 5678);
|
||||
Authtoken.ObtainAuthToken("testService", args[0]);
|
||||
|
||||
byte[] baToken = Authtoken.ObtainAuthToken("testService", args[0]);
|
||||
Console.WriteLine("Token returned: ("+ baToken.Length + ")");
|
||||
@@ -61,6 +61,11 @@ namespace TestClientAuth
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Press enter to continue");
|
||||
Console.ReadLine();
|
||||
|
||||
// Cleanup the AuthTokenCache
|
||||
Console.WriteLine("Cleaning the cache");
|
||||
Authtoken.CleanUpAuthTokenCache();
|
||||
Console.WriteLine("Done cleaning the cache");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -1,109 +1,106 @@
|
||||
<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>
|
||||
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{0EA635EA-97F2-4950-B36B-8151ED858DA4}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>App.ico</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>TestClientAuth</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>TestClientAuth</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Novell.Casa.Client.Auth, Version=1.7.2659.17530, Culture=neutral, PublicKeyToken=ed0eb71059ea593b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Novell.Casa.Authtoken\bin\Debug\Novell.Casa.Client.Auth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.XML">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="App.ico" />
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Class1.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user