use of org.lastaflute.core.security.PrimaryCipher in project fess by codelibs.
the class UserInfoHelper method getUserCodeFromUserBean.
protected String getUserCodeFromUserBean(final HttpServletRequest request) {
final SessionManager sessionManager = ComponentUtil.getComponent(SessionManager.class);
String userCode = sessionManager.getAttribute(USER_BEAN, TypicalUserBean.class).filter(u -> !Constants.EMPTY_USER_ID.equals(u.getUserId())).map(u -> u.getUserId().toString()).orElse(StringUtil.EMPTY);
if (StringUtil.isBlank(userCode)) {
return null;
}
final PrimaryCipher cipher = ComponentUtil.getPrimaryCipher();
userCode = cipher.encrypt(userCode);
request.setAttribute(Constants.USER_CODE, userCode);
deleteUserCodeFromCookie(request);
return userCode;
}
Aggregations