Changed the APIs into the token cache to get ready to migrate it over the miCASA cache.

This commit is contained in:
Juan Carlos Luciani 2006-06-02 16:58:27 +00:00
parent 24a8d44e2c
commit ce3ecb8dd9
3 changed files with 103 additions and 10 deletions

View File

@ -88,7 +88,7 @@ ObtainSessionToken(
pAuthContext = CONTAINING_RECORD(pListEntry, AuthContext, listEntry);
// Try to find a cache entry for the auth context
pCacheEntry = FindEntryInAuthCache(pAuthContext->pContext, NULL);
pCacheEntry = FindSessionTokenEntryInCache(pAuthContext->pContext);
if (pCacheEntry != NULL)
{
// Cache entry found, check if it is of use to us.
@ -122,7 +122,7 @@ ObtainSessionToken(
// Only try to create cache entry for the auth context if there is not
// one already.
pCacheEntry = FindEntryInAuthCache(pAuthContext->pContext, NULL);
pCacheEntry = FindSessionTokenEntryInCache(pAuthContext->pContext);
if (pCacheEntry == NULL)
{
// Get authentication mechanism token
@ -138,7 +138,7 @@ ObtainSessionToken(
}
// Create a cache entry for the auth context
pCacheEntry = CreateAuthCacheEntry(pAuthContext->pContext, NULL);
pCacheEntry = CreateSessionTokenCacheEntry(pAuthContext->pContext);
if (pCacheEntry)
{
char *pReqMsg = NULL;
@ -146,7 +146,7 @@ ObtainSessionToken(
int respLen;
int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure
// Request auth token for the service
// Authenticate to the ATS
pReqMsg = BuildAuthenticateMsg(pAuthContext, pAuthMechToken);
if (pReqMsg)
{
@ -506,11 +506,11 @@ ObtainAuthToken(
AcquireUserMutex();
// Try to find a cache entry for the service
pCacheEntry = FindEntryInAuthCache(pServiceName, pNormalizedHostName);
pCacheEntry = FindAuthTokenEntryInCache(pServiceName, pNormalizedHostName);
if (pCacheEntry == NULL)
{
// No entry found in the cache, create one.
pCacheEntry = CreateAuthCacheEntry(pServiceName, pNormalizedHostName);
pCacheEntry = CreateAuthTokenCacheEntry(pServiceName, pNormalizedHostName);
if (pCacheEntry)
{
int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure

View File

@ -221,9 +221,14 @@ RelGetAuthTokenResp(
extern
AuthCacheEntry*
CreateAuthCacheEntry(
CreateSessionTokenCacheEntry(
IN const char *pCacheKey);
extern
AuthCacheEntry*
CreateAuthTokenCacheEntry(
IN const char *pCacheKey,
IN const char *pHostName);
IN const char *pGroupOrHostName);
extern
void
@ -236,9 +241,14 @@ IncAuthCacheEntryRefCount(
extern
AuthCacheEntry*
FindEntryInAuthCache(
FindSessionTokenEntryInCache(
IN const char *pCacheKey);
extern
AuthCacheEntry*
FindAuthTokenEntryInCache(
IN const char *pCacheKey,
IN const char *pHostName);
IN const char *pGroupOrHostName);
extern
void

View File

@ -56,6 +56,7 @@ static
int g_cacheEntryCount = 0;
//++=======================================================================
static
AuthCacheEntry*
CreateAuthCacheEntry(
IN const char *pCacheKeyName,
@ -140,6 +141,47 @@ CreateAuthCacheEntry(
}
//++=======================================================================
AuthCacheEntry*
CreateSessionTokenCacheEntry(
IN const char *pCacheKey)
//
// Arguments:
//
// Returns:
//
// Abstract:
//
// Notes:
//
// L2
//=======================================================================--
{
return CreateAuthCacheEntry(pCacheKey, NULL);
}
//++=======================================================================
AuthCacheEntry*
CreateAuthTokenCacheEntry(
IN const char *pCacheKey,
IN const char *pGroupOrHostName)
//
// Arguments:
//
// Returns:
//
// Abstract:
//
// Notes:
//
// L2
//=======================================================================--
{
return CreateAuthCacheEntry(pCacheKey, pGroupOrHostName);
}
//++=======================================================================
static
void
@ -300,6 +342,7 @@ CacheEntryLifetimeExpired(
//++=======================================================================
static
AuthCacheEntry*
FindEntryInAuthCache(
IN const char *pCacheKeyName,
@ -603,6 +646,46 @@ FindEntryInAuthCache(
}
//++=======================================================================
AuthCacheEntry*
FindSessionTokenEntryInCache(
IN const char *pCacheKey)
//
// Arguments:
//
// Returns:
//
// Abstract:
//
// Notes:
//
// L2
//=======================================================================--
{
return FindEntryInAuthCache(pCacheKey, NULL);
}
//++=======================================================================
AuthCacheEntry*
FindAuthTokenEntryInCache(
IN const char *pCacheKey,
IN const char *pGroupOrHostName)
//
// Arguments:
//
// Returns:
//
// Abstract:
//
// Notes:
//
// L2
//=======================================================================--
{
return FindEntryInAuthCache(pCacheKey, pGroupOrHostName);
}
//++=======================================================================
void
AddEntryToAuthCache(