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);
|
||||
|
||||
Reference in New Issue
Block a user