Search in sources :

Example 1 with AuthenticationResultCacheKey

use of org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey in project carbon-identity-framework by wso2.

the class FrameworkUtils method removeAuthenticationResultFromCache.

/**
 *  Removes authentication result from cache.
 * @param autheticationResultId
 */
public static void removeAuthenticationResultFromCache(String autheticationResultId) {
    if (autheticationResultId != null) {
        AuthenticationResultCacheKey cacheKey = new AuthenticationResultCacheKey(autheticationResultId);
        AuthenticationResultCache.getInstance().clearCacheEntry(cacheKey);
    }
}
Also used : AuthenticationResultCacheKey(org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey)

Example 2 with AuthenticationResultCacheKey

use of org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey in project carbon-identity-framework by wso2.

the class FrameworkUtils method addAuthenticationResultToCache.

/**
 * @param key
 * @param authenticationResult
 */
public static void addAuthenticationResultToCache(String key, AuthenticationResult authenticationResult) {
    AuthenticationResultCacheKey cacheKey = new AuthenticationResultCacheKey(key);
    AuthenticationResultCacheEntry cacheEntry = new AuthenticationResultCacheEntry();
    cacheEntry.setResult(authenticationResult);
    cacheEntry.setValidityPeriod(TimeUnit.MINUTES.toNanos(IdentityUtil.getOperationCleanUpTimeout()));
    AuthenticationResultCache.getInstance().addToCache(cacheKey, cacheEntry);
}
Also used : AuthenticationResultCacheEntry(org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheEntry) AuthenticationResultCacheKey(org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey)

Example 3 with AuthenticationResultCacheKey

use of org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey in project carbon-identity-framework by wso2.

the class FrameworkUtils method getAuthenticationResultFromCache.

/**
 * To get authentication cache result from cache.
 * @param key
 * @return
 */
public static AuthenticationResultCacheEntry getAuthenticationResultFromCache(String key) {
    AuthenticationResultCacheKey cacheKey = new AuthenticationResultCacheKey(key);
    AuthenticationResultCacheEntry authResult = AuthenticationResultCache.getInstance().getValueFromCache(cacheKey);
    return authResult;
}
Also used : AuthenticationResultCacheEntry(org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheEntry) AuthenticationResultCacheKey(org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey)

Aggregations

AuthenticationResultCacheKey (org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheKey)3 AuthenticationResultCacheEntry (org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationResultCacheEntry)2