Search in sources :

Example 1 with UserProfileCachable

use of com.wso2telco.core.userprofile.cache.UserProfileCachable in project core-util by WSO2Telco.

the class JSessionAuthenticationFilter method isAuthenticated.

@Override
public boolean isAuthenticated(ContainerRequestContext requestContext, Method method, String header) {
    boolean isExpired = false;
    try {
        UserProfileCachable cachable = CacheFactory.getInstance(CacheType.LOCAL).getService();
        String sessionId = header.replace(AuthFilterParam.JSESSION_ID.getTObject(), "");
        isExpired = cachable.isExpired(sessionId);
        if (isExpired) {
            requestContext.abortWith(accessDenied);
            return false;
        }
        UserProfileDTO userProfileDTO = cachable.get(sessionId);
        userName = userProfileDTO.getUserName();
        log.debug("username : " + userName);
    } catch (BusinessException e) {
        requestContext.abortWith(accessDenied);
        return false;
    }
    return true;
}
Also used : BusinessException(com.wso2telco.core.dbutils.exception.BusinessException) UserProfileCachable(com.wso2telco.core.userprofile.cache.UserProfileCachable) UserProfileDTO(com.wso2telco.core.userprofile.dto.UserProfileDTO)

Aggregations

BusinessException (com.wso2telco.core.dbutils.exception.BusinessException)1 UserProfileCachable (com.wso2telco.core.userprofile.cache.UserProfileCachable)1 UserProfileDTO (com.wso2telco.core.userprofile.dto.UserProfileDTO)1