Search in sources :

Example 1 with DefaultAuthSeqMgtCacheEntry

use of org.wso2.carbon.identity.application.mgt.cache.DefaultAuthSeqMgtCacheEntry in project carbon-identity-framework by wso2.

the class DefaultAuthSeqMgtServiceImpl method addDefaultAuthSeqToCache.

private void addDefaultAuthSeqToCache(DefaultAuthenticationSequence sequence, String tenantDomain) {
    if (DefaultAuthSeqMgtCache.getInstance().isEnabled()) {
        DefaultAuthSeqMgtCacheEntry entry = new DefaultAuthSeqMgtCacheEntry(sequence);
        DefaultAuthSeqMgtCache.getInstance().addToCache(sequence.getName(), entry, tenantDomain);
        if (log.isDebugEnabled()) {
            log.debug("Default authentication sequence for tenant: " + tenantDomain + " is added to cache.");
        }
    }
}
Also used : DefaultAuthSeqMgtCacheEntry(org.wso2.carbon.identity.application.mgt.cache.DefaultAuthSeqMgtCacheEntry)

Example 2 with DefaultAuthSeqMgtCacheEntry

use of org.wso2.carbon.identity.application.mgt.cache.DefaultAuthSeqMgtCacheEntry in project carbon-identity-framework by wso2.

the class DefaultAuthSeqMgtServiceImpl method doGetDefaultAuthSeq.

private DefaultAuthenticationSequence doGetDefaultAuthSeq(String sequenceName, String tenantDomain) throws DefaultAuthSeqMgtException {
    if (DefaultAuthSeqMgtCache.getInstance().isEnabled()) {
        DefaultAuthSeqMgtCacheEntry entry = DefaultAuthSeqMgtCache.getInstance().getValueFromCache(sequenceName, tenantDomain);
        if (entry != null) {
            if (log.isDebugEnabled()) {
                log.debug("Default authentication sequence of tenant: " + tenantDomain + " is retrieved from cache.");
            }
            return entry.getSequence();
        }
    }
    DefaultAuthSeqMgtDAO seqMgtDAO = new DefaultAuthSeqMgtDAOImpl();
    DefaultAuthenticationSequence sequence = seqMgtDAO.getDefaultAuthenticationSeq(sequenceName, tenantDomain);
    if (sequence != null) {
        addDefaultAuthSeqToCache(sequence, tenantDomain);
    }
    return sequence;
}
Also used : DefaultAuthSeqMgtCacheEntry(org.wso2.carbon.identity.application.mgt.cache.DefaultAuthSeqMgtCacheEntry) DefaultAuthenticationSequence(org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence) DefaultAuthSeqMgtDAOImpl(org.wso2.carbon.identity.application.mgt.dao.impl.DefaultAuthSeqMgtDAOImpl) DefaultAuthSeqMgtDAO(org.wso2.carbon.identity.application.mgt.dao.DefaultAuthSeqMgtDAO)

Aggregations

DefaultAuthSeqMgtCacheEntry (org.wso2.carbon.identity.application.mgt.cache.DefaultAuthSeqMgtCacheEntry)2 DefaultAuthenticationSequence (org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence)1 DefaultAuthSeqMgtDAO (org.wso2.carbon.identity.application.mgt.dao.DefaultAuthSeqMgtDAO)1 DefaultAuthSeqMgtDAOImpl (org.wso2.carbon.identity.application.mgt.dao.impl.DefaultAuthSeqMgtDAOImpl)1