Search in sources :

Example 1 with OAuthUserConsentedScopeCacheEntry

use of org.wso2.carbon.identity.oauth2.internal.cache.OAuthUserConsentedScopeCacheEntry in project identity-inbound-auth-oauth by wso2-extensions.

the class CacheBackedOAuthUserConsentedScopesDAOImpl method getUserConsentForApplication.

@Override
public UserApplicationScopeConsentDO getUserConsentForApplication(String userId, String appId, int tenantId) throws IdentityOAuth2ScopeConsentException {
    OAuthUserConsentedScopeCacheEntry entry = cache.getValueFromCache(userId, tenantId);
    if (entry != null && entry.getAppID().equals(appId)) {
        return entry.getUserApplicationScopeConsentDO();
    }
    UserApplicationScopeConsentDO userConsent = dao.getUserConsentForApplication(userId, appId, tenantId);
    cache.addToCache(userId, new OAuthUserConsentedScopeCacheEntry(appId, userConsent), tenantId);
    return userConsent;
}
Also used : UserApplicationScopeConsentDO(org.wso2.carbon.identity.oauth2.model.UserApplicationScopeConsentDO) OAuthUserConsentedScopeCacheEntry(org.wso2.carbon.identity.oauth2.internal.cache.OAuthUserConsentedScopeCacheEntry)

Aggregations

OAuthUserConsentedScopeCacheEntry (org.wso2.carbon.identity.oauth2.internal.cache.OAuthUserConsentedScopeCacheEntry)1 UserApplicationScopeConsentDO (org.wso2.carbon.identity.oauth2.model.UserApplicationScopeConsentDO)1