@PostConstruct public void init() { StreamUtil.of(ComponentUtil.getFessConfig().getSearchDefaultRoles().split(",")) .filter(name -> StringUtil.isNotBlank(name)) .forEach( name -> { defaultRoleList.add(name); }); }
/* (non-Javadoc) * @see org.codelibs.fess.helper.impl.RoleQueryHelper#build() */ @Override public Set<String> build() { final Set<String> roleList = new HashSet<>(); final HttpServletRequest request = LaRequestUtil.getOptionalRequest().orElse(null); // request parameter if (request != null && StringUtil.isNotBlank(parameterKey)) { roleList.addAll(buildByParameter(request)); } // request header if (request != null && StringUtil.isNotBlank(headerKey)) { roleList.addAll(buildByHeader(request)); } // cookie if (request != null && StringUtil.isNotBlank(cookieKey)) { roleList.addAll(buildByCookie(request)); } // cookie mapping if (cookieNameMap != null) { roleList.addAll(buildByCookieNameMapping(request)); } final FessLoginAssist fessLoginAssist = ComponentUtil.getComponent(FessLoginAssist.class); fessLoginAssist .getSessionUserBean() .ifPresent( fessUserBean -> StreamUtil.of(fessUserBean.getRoles()) .map(role -> Base64.getDecoder().decode(role)) .map( role -> { try { return Optional.of(new String(role, Constants.UTF_8)); } catch (final IOException e) { return null; } }) .forEach(role -> role.ifPresent(roleList::add))); if (defaultRoleList != null) { roleList.addAll(defaultRoleList); } if (logger.isDebugEnabled()) { logger.debug("roleList: " + roleList); } return roleList; }