Added flush AuthToken cache API.
This commit is contained in:
parent
2342ee4dd0
commit
099e4cabfc
CASA-auth-token/client
csharp-api
include
library
@ -70,6 +70,12 @@ namespace Novell.Casa.Client.Auth
|
|||||||
[In] SSCS_EXT_T ext
|
[In] SSCS_EXT_T ext
|
||||||
);
|
);
|
||||||
|
|
||||||
|
[DllImport(AUTH_LIBRARY, CharSet = CharSet.None)]
|
||||||
|
private static extern int CleanUpAuthTokenCacheEx
|
||||||
|
(
|
||||||
|
[In] SSCS_EXT_T ext
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public Authtoken()
|
public Authtoken()
|
||||||
{
|
{
|
||||||
@ -94,7 +100,7 @@ namespace Novell.Casa.Client.Auth
|
|||||||
return ObtainAuthToken(sService, sHost, null);
|
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;
|
int rcode = 0;
|
||||||
byte[] baService = null;
|
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)
|
private static void LogMessage(string sMessage)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Trace.WriteLine("(C#)AuthToken: " + sMessage);
|
System.Diagnostics.Trace.WriteLine("(C#)AuthToken: " + sMessage);
|
||||||
|
@ -49,8 +49,8 @@ namespace TestClientAuth
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
WinLuid luid = new WinLuid(1234, 5678);
|
//WinLuid luid = new WinLuid(1234, 5678);
|
||||||
Authtoken.ObtainAuthToken("testService", args[0], luid);
|
Authtoken.ObtainAuthToken("testService", args[0]);
|
||||||
|
|
||||||
byte[] baToken = Authtoken.ObtainAuthToken("testService", args[0]);
|
byte[] baToken = Authtoken.ObtainAuthToken("testService", args[0]);
|
||||||
Console.WriteLine("Token returned: ("+ baToken.Length + ")");
|
Console.WriteLine("Token returned: ("+ baToken.Length + ")");
|
||||||
@ -61,6 +61,11 @@ namespace TestClientAuth
|
|||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
Console.WriteLine("Press enter to continue");
|
Console.WriteLine("Press enter to continue");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
|
|
||||||
|
// Cleanup the AuthTokenCache
|
||||||
|
Console.WriteLine("Cleaning the cache");
|
||||||
|
Authtoken.CleanUpAuthTokenCache();
|
||||||
|
Console.WriteLine("Done cleaning the cache");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1,109 +1,106 @@
|
|||||||
<VisualStudioProject>
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<CSHARP
|
<PropertyGroup>
|
||||||
ProjectType = "Local"
|
<ProjectType>Local</ProjectType>
|
||||||
ProductVersion = "7.10.3077"
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
SchemaVersion = "2.0"
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
ProjectGuid = "{0EA635EA-97F2-4950-B36B-8151ED858DA4}"
|
<ProjectGuid>{0EA635EA-97F2-4950-B36B-8151ED858DA4}</ProjectGuid>
|
||||||
>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Build>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<Settings
|
<ApplicationIcon>App.ico</ApplicationIcon>
|
||||||
ApplicationIcon = "App.ico"
|
<AssemblyKeyContainerName>
|
||||||
AssemblyKeyContainerName = ""
|
</AssemblyKeyContainerName>
|
||||||
AssemblyName = "TestClientAuth"
|
<AssemblyName>TestClientAuth</AssemblyName>
|
||||||
AssemblyOriginatorKeyFile = ""
|
<AssemblyOriginatorKeyFile>
|
||||||
DefaultClientScript = "JScript"
|
</AssemblyOriginatorKeyFile>
|
||||||
DefaultHTMLPageLayout = "Grid"
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
DefaultTargetSchema = "IE50"
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
DelaySign = "false"
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
OutputType = "Exe"
|
<DelaySign>false</DelaySign>
|
||||||
PreBuildEvent = ""
|
<OutputType>Exe</OutputType>
|
||||||
PostBuildEvent = ""
|
<RootNamespace>TestClientAuth</RootNamespace>
|
||||||
RootNamespace = "TestClientAuth"
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
RunPostBuildEvent = "OnBuildSuccess"
|
<StartupObject>
|
||||||
StartupObject = ""
|
</StartupObject>
|
||||||
>
|
<FileUpgradeFlags>
|
||||||
<Config
|
</FileUpgradeFlags>
|
||||||
Name = "Debug"
|
<UpgradeBackupLocation>
|
||||||
AllowUnsafeBlocks = "false"
|
</UpgradeBackupLocation>
|
||||||
BaseAddress = "285212672"
|
</PropertyGroup>
|
||||||
CheckForOverflowUnderflow = "false"
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
ConfigurationOverrideFile = ""
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
DefineConstants = "DEBUG;TRACE"
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
DocumentationFile = ""
|
<BaseAddress>285212672</BaseAddress>
|
||||||
DebugSymbols = "true"
|
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||||
FileAlignment = "4096"
|
<ConfigurationOverrideFile>
|
||||||
IncrementalBuild = "false"
|
</ConfigurationOverrideFile>
|
||||||
NoStdLib = "false"
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
NoWarn = ""
|
<DocumentationFile>
|
||||||
Optimize = "false"
|
</DocumentationFile>
|
||||||
OutputPath = "bin\Debug\"
|
<DebugSymbols>true</DebugSymbols>
|
||||||
RegisterForComInterop = "false"
|
<FileAlignment>4096</FileAlignment>
|
||||||
RemoveIntegerChecks = "false"
|
<NoStdLib>false</NoStdLib>
|
||||||
TreatWarningsAsErrors = "false"
|
<NoWarn>
|
||||||
WarningLevel = "4"
|
</NoWarn>
|
||||||
/>
|
<Optimize>false</Optimize>
|
||||||
<Config
|
<RegisterForComInterop>false</RegisterForComInterop>
|
||||||
Name = "Release"
|
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||||
AllowUnsafeBlocks = "false"
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
BaseAddress = "285212672"
|
<WarningLevel>4</WarningLevel>
|
||||||
CheckForOverflowUnderflow = "false"
|
<DebugType>full</DebugType>
|
||||||
ConfigurationOverrideFile = ""
|
<ErrorReport>prompt</ErrorReport>
|
||||||
DefineConstants = "TRACE"
|
</PropertyGroup>
|
||||||
DocumentationFile = ""
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
DebugSymbols = "false"
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
FileAlignment = "4096"
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
IncrementalBuild = "false"
|
<BaseAddress>285212672</BaseAddress>
|
||||||
NoStdLib = "false"
|
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||||
NoWarn = ""
|
<ConfigurationOverrideFile>
|
||||||
Optimize = "true"
|
</ConfigurationOverrideFile>
|
||||||
OutputPath = "bin\Release\"
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
RegisterForComInterop = "false"
|
<DocumentationFile>
|
||||||
RemoveIntegerChecks = "false"
|
</DocumentationFile>
|
||||||
TreatWarningsAsErrors = "false"
|
<DebugSymbols>false</DebugSymbols>
|
||||||
WarningLevel = "4"
|
<FileAlignment>4096</FileAlignment>
|
||||||
/>
|
<NoStdLib>false</NoStdLib>
|
||||||
</Settings>
|
<NoWarn>
|
||||||
<References>
|
</NoWarn>
|
||||||
<Reference
|
<Optimize>true</Optimize>
|
||||||
Name = "System"
|
<RegisterForComInterop>false</RegisterForComInterop>
|
||||||
AssemblyName = "System"
|
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
/>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Reference
|
<DebugType>none</DebugType>
|
||||||
Name = "System.Data"
|
<ErrorReport>prompt</ErrorReport>
|
||||||
AssemblyName = "System.Data"
|
</PropertyGroup>
|
||||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
<ItemGroup>
|
||||||
/>
|
<Reference Include="Novell.Casa.Client.Auth, Version=1.7.2659.17530, Culture=neutral, PublicKeyToken=ed0eb71059ea593b, processorArchitecture=MSIL">
|
||||||
<Reference
|
<SpecificVersion>False</SpecificVersion>
|
||||||
Name = "System.XML"
|
<HintPath>..\Novell.Casa.Authtoken\bin\Debug\Novell.Casa.Client.Auth.dll</HintPath>
|
||||||
AssemblyName = "System.XML"
|
</Reference>
|
||||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
<Reference Include="System">
|
||||||
/>
|
<Name>System</Name>
|
||||||
<Reference
|
</Reference>
|
||||||
Name = "Novell.Casa.Client"
|
<Reference Include="System.Data">
|
||||||
Project = "{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}"
|
<Name>System.Data</Name>
|
||||||
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
|
</Reference>
|
||||||
/>
|
<Reference Include="System.XML">
|
||||||
</References>
|
<Name>System.XML</Name>
|
||||||
</Build>
|
</Reference>
|
||||||
<Files>
|
</ItemGroup>
|
||||||
<Include>
|
<ItemGroup>
|
||||||
<File
|
<Content Include="App.ico" />
|
||||||
RelPath = "App.ico"
|
<Compile Include="AssemblyInfo.cs">
|
||||||
BuildAction = "Content"
|
<SubType>Code</SubType>
|
||||||
/>
|
</Compile>
|
||||||
<File
|
<Compile Include="Class1.cs">
|
||||||
RelPath = "AssemblyInfo.cs"
|
<SubType>Code</SubType>
|
||||||
SubType = "Code"
|
</Compile>
|
||||||
BuildAction = "Compile"
|
</ItemGroup>
|
||||||
/>
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<File
|
<PropertyGroup>
|
||||||
RelPath = "Class1.cs"
|
<PreBuildEvent>
|
||||||
SubType = "Code"
|
</PreBuildEvent>
|
||||||
BuildAction = "Compile"
|
<PostBuildEvent>
|
||||||
/>
|
</PostBuildEvent>
|
||||||
</Include>
|
</PropertyGroup>
|
||||||
</Files>
|
</Project>
|
||||||
</CSHARP>
|
|
||||||
</VisualStudioProject>
|
|
||||||
|
|
@ -94,6 +94,20 @@ ObtainAuthToken(
|
|||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
extern void SSCS_CALL
|
||||||
|
CleanUpAuthTokenCache(void);
|
||||||
|
//
|
||||||
|
// Arguments: None.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Nothing
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Flush the AuthToken cache.
|
||||||
|
//=======================================================================--
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
}
|
}
|
||||||
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
@ -51,7 +51,7 @@ extern "C"
|
|||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
CasaStatus SSCS_CALL
|
extern CasaStatus SSCS_CALL
|
||||||
ObtainAuthTokenEx(
|
ObtainAuthTokenEx(
|
||||||
IN const char *pServiceName,
|
IN const char *pServiceName,
|
||||||
IN const char *pHostName,
|
IN const char *pHostName,
|
||||||
@ -101,6 +101,25 @@ ObtainAuthTokenEx(
|
|||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
extern void SSCS_CALL
|
||||||
|
CleanUpAuthTokenCacheEx(
|
||||||
|
IN const void *pCredStoreScope);
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// pCredStoreScope -
|
||||||
|
// Pointer to CASA structure for scoping credential store access
|
||||||
|
// to specific users. This can only be leveraged by applications
|
||||||
|
// running in the context of System.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Nothing
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Flush the AuthToken cache.
|
||||||
|
//=======================================================================--
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
}
|
}
|
||||||
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
@ -709,6 +709,78 @@ RemoveSessionTokenEntryInCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
void
|
||||||
|
DeleteAuthTokenEntriesInCache(
|
||||||
|
IN void *pCredStoreScope
|
||||||
|
)
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
//
|
||||||
|
// Abstract:
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
//
|
||||||
|
// L2
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
int32_t miCasaStatus;
|
||||||
|
SSCS_SECRET_ID_T sharedId = {27, "CASA_AUTHENTICATION_TOKENS"};
|
||||||
|
|
||||||
|
DbgTrace(1, "-DeleteAuthTokenEntriesInCache- Start\n", 0);
|
||||||
|
|
||||||
|
// Remove all of the auth tokens from the cache
|
||||||
|
miCasaStatus = miCASARemoveCredential(0,
|
||||||
|
&sharedId,
|
||||||
|
(SSCS_SECRET_ID_T*) NULL,
|
||||||
|
(SSCS_EXT_T*) pCredStoreScope);
|
||||||
|
if (miCasaStatus != NSSCS_SUCCESS)
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-DeleteAuthTokenEntriesInCache- miCASADeleteCredential error = %0X\n", miCasaStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgTrace(1, "-DeleteAuthTokenEntriesInCache- End\n", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
void
|
||||||
|
DeleteSessionTokenEntriesInCache(
|
||||||
|
IN void *pCredStoreScope
|
||||||
|
)
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
//
|
||||||
|
// Abstract:
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
//
|
||||||
|
// L2
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
int32_t miCasaStatus;
|
||||||
|
SSCS_SECRET_ID_T sharedId = {20, "CASA_SESSION_TOKENS"};
|
||||||
|
|
||||||
|
DbgTrace(1, "-DeleteSessionTokenEntriesInCache- Start\n", 0);
|
||||||
|
|
||||||
|
// Remove all of the auth tokens from the cache
|
||||||
|
miCasaStatus = miCASARemoveCredential(0,
|
||||||
|
&sharedId,
|
||||||
|
(SSCS_SECRET_ID_T*) NULL,
|
||||||
|
(SSCS_EXT_T*) pCredStoreScope);
|
||||||
|
if (miCasaStatus != NSSCS_SUCCESS)
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-DeleteSessionTokenEntriesInCache- miCASADeleteCredential error = %0X\n", miCasaStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgTrace(1, "-DeleteSessionTokenEntriesInCache- End\n", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
CasaStatus
|
CasaStatus
|
||||||
InitializeAuthCache()
|
InitializeAuthCache()
|
||||||
|
@ -833,6 +833,101 @@ ObtainAuthToken(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
void
|
||||||
|
CleanUpAuthTokenCacheInt(
|
||||||
|
IN const void *pCredStoreScope)
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// pCredStoreScope -
|
||||||
|
// Pointer to CASA structure for scoping credential store access
|
||||||
|
// to specific users. This can only be leveraged by applications
|
||||||
|
// running in the context of System.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Nothing
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Flush the AuthToken cache.
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
CasaStatus retStatus;
|
||||||
|
HANDLE hUserMutex = NULL;
|
||||||
|
|
||||||
|
DbgTrace(1, "-CleanUpAuthTokenCacheInt- Start\n", 0);
|
||||||
|
|
||||||
|
// Obtain our synchronization mutex
|
||||||
|
AcquireModuleMutex;
|
||||||
|
|
||||||
|
// Create user synchronization mutex
|
||||||
|
retStatus = CreateUserMutex(&hUserMutex);
|
||||||
|
if (retStatus != CASA_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-CleanUpAuthTokenCacheInt- Error creating mutex for the user\n", 0);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we are fully initialized
|
||||||
|
if (g_bInitialized == false)
|
||||||
|
{
|
||||||
|
retStatus = InitializeLibrary();
|
||||||
|
|
||||||
|
if (retStatus == CASA_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
g_bInitialized = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release our synchronization mutex
|
||||||
|
ReleaseModuleMutex;
|
||||||
|
|
||||||
|
// Start user process synchronization
|
||||||
|
AcquireUserMutex(hUserMutex);
|
||||||
|
|
||||||
|
// Delete all of the tokens in our cache
|
||||||
|
DeleteAuthTokenEntriesInCache(pCredStoreScope);
|
||||||
|
DeleteSessionTokenEntriesInCache(pCredStoreScope);
|
||||||
|
|
||||||
|
// Stop user process synchronization
|
||||||
|
ReleaseUserMutex(hUserMutex);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
|
||||||
|
if (hUserMutex != NULL)
|
||||||
|
{
|
||||||
|
DestroyUserMutex(hUserMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgTrace(1, "-CleanUpAuthTokenCacheInt- End\n", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
void SSCS_CALL
|
||||||
|
CleanUpAuthTokenCache(void)
|
||||||
|
//
|
||||||
|
// Arguments: None.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Nothing
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Flush the AuthToken cache.
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
DbgTrace(1, "-CleanUpAuthTokenCache- Start\n", 0);
|
||||||
|
|
||||||
|
// Call our internal worker
|
||||||
|
CleanUpAuthTokenCacheInt(NULL);
|
||||||
|
|
||||||
|
DbgTrace(1, "-CleanUpAuthTokenCache- End\n", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
int
|
int
|
||||||
InitializeLibrary(void)
|
InitializeLibrary(void)
|
||||||
|
@ -299,6 +299,16 @@ RemoveSessionTokenEntryInCache(
|
|||||||
IN const char *pCacheKey,
|
IN const char *pCacheKey,
|
||||||
IN void *pCredStoreScope);
|
IN void *pCredStoreScope);
|
||||||
|
|
||||||
|
extern
|
||||||
|
void
|
||||||
|
DeleteAuthTokenEntriesInCache(
|
||||||
|
IN void *pCredStoreScope);
|
||||||
|
|
||||||
|
extern
|
||||||
|
void
|
||||||
|
DeleteSessionTokenEntriesInCache(
|
||||||
|
IN void *pCredStoreScope);
|
||||||
|
|
||||||
extern
|
extern
|
||||||
CasaStatus
|
CasaStatus
|
||||||
InitializeAuthCache(void);
|
InitializeAuthCache(void);
|
||||||
|
@ -167,6 +167,10 @@ int main(int argc, char* argv[])
|
|||||||
printf("Press 'Enter' to run test or 'n + Enter' to stop.\n");
|
printf("Press 'Enter' to run test or 'n + Enter' to stop.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup the AuthToken cache to start clean the next time that
|
||||||
|
// we run the test application.
|
||||||
|
CleanUpAuthTokenCache();
|
||||||
|
|
||||||
// Close winsock
|
// Close winsock
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,6 @@ EXPORTS
|
|||||||
; DllGetClassObject PRIVATE
|
; DllGetClassObject PRIVATE
|
||||||
ObtainAuthToken PRIVATE
|
ObtainAuthToken PRIVATE
|
||||||
ObtainAuthTokenEx PRIVATE
|
ObtainAuthTokenEx PRIVATE
|
||||||
|
CleanUpAuthTokenCache PRIVATE
|
||||||
|
CleanUpAuthTokenCacheEx PRIVATE
|
||||||
; DllCanUnloadNow PRIVATE
|
; DllCanUnloadNow PRIVATE
|
@ -68,7 +68,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
IgnoreImportLibrary="false"
|
IgnoreImportLibrary="false"
|
||||||
AdditionalOptions="/EXPORT:ObtainAuthToken /EXPORT:ObtainAuthTokenEx"
|
AdditionalOptions="/EXPORT:ObtainAuthToken /EXPORT:ObtainAuthTokenEx /EXPORT:CleanUpAuthTokenCache /EXPORT:CleanUpAuthTokenCacheEx"
|
||||||
AdditionalDependencies="ws2_32.lib winhttp.lib libexpatmt.lib micasa.lib shlwapi.lib"
|
AdditionalDependencies="ws2_32.lib winhttp.lib libexpatmt.lib micasa.lib shlwapi.lib"
|
||||||
OutputFile="$(OutDir)/casa_authtoken.dll"
|
OutputFile="$(OutDir)/casa_authtoken.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
@ -107,6 +107,90 @@
|
|||||||
CommandLine=""
|
CommandLine=""
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="..\windows\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="..\windows\$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D "XML_STATIC" /D "_CRT_SECURE_NO_DEPRECATE""
|
||||||
|
AdditionalIncludeDirectories=".;..\;..\..\include;..\..\include\windows;"$(MS_SDK_DIR)\include";"$(CASA32_SDK_DIR)\include";"..\..\..\..\..\Expat-2.0.0\Source\lib""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalOptions="/EXPORT:ObtainAuthToken /EXPORT:ObtainAuthTokenEx /EXPORT:CleanUpAuthTokenCache /EXPORT:CleanUpAuthTokenCacheEx"
|
||||||
|
AdditionalDependencies="ws2_32.lib winhttp.lib libexpatmt.lib micasa.lib shlwapi.lib"
|
||||||
|
OutputFile="$(OutDir)/casa_authtoken.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
AdditionalLibraryDirectories=""$(MS_SDK_DIR)\lib";"$(CASA32_SDK_DIR)\lib";"..\..\..\..\..\Expat-2.0.0\StaticLibs""
|
||||||
|
IgnoreDefaultLibraryNames="libc"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="0"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
ImportLibrary="$(SolutionDir)lib\windows\$(TargetName).lib"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
CommandLine=""
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
@ -198,90 +282,6 @@
|
|||||||
CommandLine=""
|
CommandLine=""
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="..\windows\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="..\windows\$(ConfigurationName)"
|
|
||||||
ConfigurationType="2"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="/D "XML_STATIC" /D "_CRT_SECURE_NO_DEPRECATE""
|
|
||||||
AdditionalIncludeDirectories=".;..\;..\..\include;..\..\include\windows;"$(MS_SDK_DIR)\include";"$(CASA32_SDK_DIR)\include";"..\..\..\..\..\Expat-2.0.0\Source\lib""
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="/EXPORT:ObtainAuthToken /EXPORT:ObtainAuthTokenEx"
|
|
||||||
AdditionalDependencies="ws2_32.lib winhttp.lib libexpatmt.lib micasa.lib shlwapi.lib"
|
|
||||||
OutputFile="$(OutDir)/casa_authtoken.dll"
|
|
||||||
LinkIncremental="1"
|
|
||||||
AdditionalLibraryDirectories=""$(MS_SDK_DIR)\lib";"$(CASA32_SDK_DIR)\lib";"..\..\..\..\..\Expat-2.0.0\StaticLibs""
|
|
||||||
IgnoreDefaultLibraryNames="libc"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="0"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
ImportLibrary="$(SolutionDir)lib\windows\$(TargetName).lib"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
CommandLine=""
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
@ -122,6 +122,33 @@ ObtainAuthTokenEx(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//++=======================================================================
|
||||||
|
void SSCS_CALL
|
||||||
|
CleanUpAuthTokenCacheEx(
|
||||||
|
IN const void *pCredStoreScope)
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// pCredStoreScope -
|
||||||
|
// Pointer to CASA structure for scoping credential store access
|
||||||
|
// to specific users. This can only be leveraged by applications
|
||||||
|
// running in the context of System.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// Nothing
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Flush the AuthToken cache.
|
||||||
|
//=======================================================================--
|
||||||
|
{
|
||||||
|
DbgTrace(1, "-CleanUpAuthTokenCacheEx- Start\n", 0);
|
||||||
|
|
||||||
|
// Call our internal worker
|
||||||
|
CleanUpAuthTokenCacheInt(pCredStoreScope);
|
||||||
|
|
||||||
|
DbgTrace(1, "-CleanUpAuthTokenCacheEx- End\n", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
BOOL APIENTRY DllMain(
|
BOOL APIENTRY DllMain(
|
||||||
HANDLE hModule,
|
HANDLE hModule,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user