Changed the APIs into the token cache to get ready to migrate it over the miCASA cache.
This commit is contained in:
parent
24a8d44e2c
commit
ce3ecb8dd9
@ -88,7 +88,7 @@ ObtainSessionToken(
|
|||||||
pAuthContext = CONTAINING_RECORD(pListEntry, AuthContext, listEntry);
|
pAuthContext = CONTAINING_RECORD(pListEntry, AuthContext, listEntry);
|
||||||
|
|
||||||
// Try to find a cache entry for the auth context
|
// Try to find a cache entry for the auth context
|
||||||
pCacheEntry = FindEntryInAuthCache(pAuthContext->pContext, NULL);
|
pCacheEntry = FindSessionTokenEntryInCache(pAuthContext->pContext);
|
||||||
if (pCacheEntry != NULL)
|
if (pCacheEntry != NULL)
|
||||||
{
|
{
|
||||||
// Cache entry found, check if it is of use to us.
|
// 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
|
// Only try to create cache entry for the auth context if there is not
|
||||||
// one already.
|
// one already.
|
||||||
pCacheEntry = FindEntryInAuthCache(pAuthContext->pContext, NULL);
|
pCacheEntry = FindSessionTokenEntryInCache(pAuthContext->pContext);
|
||||||
if (pCacheEntry == NULL)
|
if (pCacheEntry == NULL)
|
||||||
{
|
{
|
||||||
// Get authentication mechanism token
|
// Get authentication mechanism token
|
||||||
@ -138,7 +138,7 @@ ObtainSessionToken(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a cache entry for the auth context
|
// Create a cache entry for the auth context
|
||||||
pCacheEntry = CreateAuthCacheEntry(pAuthContext->pContext, NULL);
|
pCacheEntry = CreateSessionTokenCacheEntry(pAuthContext->pContext);
|
||||||
if (pCacheEntry)
|
if (pCacheEntry)
|
||||||
{
|
{
|
||||||
char *pReqMsg = NULL;
|
char *pReqMsg = NULL;
|
||||||
@ -146,7 +146,7 @@ ObtainSessionToken(
|
|||||||
int respLen;
|
int respLen;
|
||||||
int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure
|
int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure
|
||||||
|
|
||||||
// Request auth token for the service
|
// Authenticate to the ATS
|
||||||
pReqMsg = BuildAuthenticateMsg(pAuthContext, pAuthMechToken);
|
pReqMsg = BuildAuthenticateMsg(pAuthContext, pAuthMechToken);
|
||||||
if (pReqMsg)
|
if (pReqMsg)
|
||||||
{
|
{
|
||||||
@ -506,11 +506,11 @@ ObtainAuthToken(
|
|||||||
AcquireUserMutex();
|
AcquireUserMutex();
|
||||||
|
|
||||||
// Try to find a cache entry for the service
|
// Try to find a cache entry for the service
|
||||||
pCacheEntry = FindEntryInAuthCache(pServiceName, pNormalizedHostName);
|
pCacheEntry = FindAuthTokenEntryInCache(pServiceName, pNormalizedHostName);
|
||||||
if (pCacheEntry == NULL)
|
if (pCacheEntry == NULL)
|
||||||
{
|
{
|
||||||
// No entry found in the cache, create one.
|
// No entry found in the cache, create one.
|
||||||
pCacheEntry = CreateAuthCacheEntry(pServiceName, pNormalizedHostName);
|
pCacheEntry = CreateAuthTokenCacheEntry(pServiceName, pNormalizedHostName);
|
||||||
if (pCacheEntry)
|
if (pCacheEntry)
|
||||||
{
|
{
|
||||||
int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure
|
int cacheEntryLifetime = retryLifetime; // Initialize to retry in case of failure
|
||||||
|
@ -221,9 +221,14 @@ RelGetAuthTokenResp(
|
|||||||
|
|
||||||
extern
|
extern
|
||||||
AuthCacheEntry*
|
AuthCacheEntry*
|
||||||
CreateAuthCacheEntry(
|
CreateSessionTokenCacheEntry(
|
||||||
|
IN const char *pCacheKey);
|
||||||
|
|
||||||
|
extern
|
||||||
|
AuthCacheEntry*
|
||||||
|
CreateAuthTokenCacheEntry(
|
||||||
IN const char *pCacheKey,
|
IN const char *pCacheKey,
|
||||||
IN const char *pHostName);
|
IN const char *pGroupOrHostName);
|
||||||
|
|
||||||
extern
|
extern
|
||||||
void
|
void
|
||||||
@ -236,9 +241,14 @@ IncAuthCacheEntryRefCount(
|
|||||||
|
|
||||||
extern
|
extern
|
||||||
AuthCacheEntry*
|
AuthCacheEntry*
|
||||||
FindEntryInAuthCache(
|
FindSessionTokenEntryInCache(
|
||||||
|
IN const char *pCacheKey);
|
||||||
|
|
||||||
|
extern
|
||||||
|
AuthCacheEntry*
|
||||||
|
FindAuthTokenEntryInCache(
|
||||||
IN const char *pCacheKey,
|
IN const char *pCacheKey,
|
||||||
IN const char *pHostName);
|
IN const char *pGroupOrHostName);
|
||||||
|
|
||||||
extern
|
extern
|
||||||
void
|
void
|
||||||
|
@ -56,6 +56,7 @@ static
|
|||||||
int g_cacheEntryCount = 0;
|
int g_cacheEntryCount = 0;
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
|
static
|
||||||
AuthCacheEntry*
|
AuthCacheEntry*
|
||||||
CreateAuthCacheEntry(
|
CreateAuthCacheEntry(
|
||||||
IN const char *pCacheKeyName,
|
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
|
static
|
||||||
void
|
void
|
||||||
@ -300,6 +342,7 @@ CacheEntryLifetimeExpired(
|
|||||||
|
|
||||||
|
|
||||||
//++=======================================================================
|
//++=======================================================================
|
||||||
|
static
|
||||||
AuthCacheEntry*
|
AuthCacheEntry*
|
||||||
FindEntryInAuthCache(
|
FindEntryInAuthCache(
|
||||||
IN const char *pCacheKeyName,
|
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
|
void
|
||||||
AddEntryToAuthCache(
|
AddEntryToAuthCache(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user