Search in sources :

Example 6 with PwmSessionBean

use of password.pwm.http.bean.PwmSessionBean in project pwm by pwm-project.

the class CryptoRequestBeanImpl method getSessionStateInfo.

@Override
public String getSessionStateInfo(final PwmRequest pwmRequest) throws PwmUnrecoverableException {
    final SecureService secureService = pwmRequest.getPwmApplication().getSecureService();
    final Map<Class, PwmSessionBean> cachedMap = (Map<Class, PwmSessionBean>) pwmRequest.getHttpServletRequest().getAttribute(attrName);
    if (cachedMap == null || cachedMap.isEmpty()) {
        return "";
    }
    if (cachedMap.size() > 1) {
        throw new IllegalStateException("unable to handle multiple session state beans");
    }
    final PwmSessionBean bean = cachedMap.values().iterator().next();
    return secureService.encryptObjectToString(bean);
}
Also used : SecureService(password.pwm.util.secure.SecureService) PwmSessionBean(password.pwm.http.bean.PwmSessionBean) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PwmSessionBean (password.pwm.http.bean.PwmSessionBean)6 HashMap (java.util.HashMap)3 Map (java.util.Map)3 PwmSecurityKey (password.pwm.util.secure.PwmSecurityKey)2 HttpSession (javax.servlet.http.HttpSession)1 PwmException (password.pwm.error.PwmException)1 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)1 SecureService (password.pwm.util.secure.SecureService)1