List of usage examples for org.apache.shiro.config Ini.Section isEmpty
public boolean isEmpty()
From source file:org.obiba.opal.core.upgrade.v2_0_x.HashShiroIniPasswordUpgradeStep.java
License:Open Source License
private Map<String, String> getUsernamePasswords() { Ini ini = new Ini(); ini.loadFromPath(srcIniFile.getAbsolutePath()); Ini.Section section = ini.getSection(IniRealm.USERS_SECTION_NAME); if (section == null || section.isEmpty()) { return Collections.emptyMap(); }/*from w ww .ja v a 2s .co m*/ Map<String, String> map = new LinkedHashMap<>(); for (Map.Entry<String, String> entry : section.entrySet()) { String username = entry.getKey(); String[] passwordAndRolesArray = StringUtils.split(entry.getValue()); String password = passwordAndRolesArray[0]; map.put(username, password); } return map; }
From source file:org.ow2.proactive.workflowcatalog.security.LoginConfigurationIniRealm.java
License:Open Source License
private void addFileDefinedUsers(Ini.Section section, String loginFilePath, String groupsFilePath) throws IOException { Map<String, UserInfo> userinfo = generateUserInfo(loginFilePath, groupsFilePath); for (String name : userinfo.keySet()) section.put(name, generateSecondArgument(userinfo.get(name))); if (section.isEmpty()) throw new RuntimeException("Shiro configuration needs at least one user to proceed"); }