@Inject public KillBillOktaRealm(final SecurityConfig securityConfig) { this.securityConfig = securityConfig; this.httpClient = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(DEFAULT_TIMEOUT_SECS * 1000).build()); if (securityConfig.getShiroOktaPermissionsByGroup() != null) { final Ini ini = new Ini(); // When passing properties on the command line, \n can be escaped ini.load(securityConfig.getShiroOktaPermissionsByGroup().replace("\\n", "\n")); for (final Section section : ini.getSections()) { for (final String role : section.keySet()) { final Collection<String> permissions = ImmutableList.<String>copyOf(SPLITTER.split(section.get(role))); permissionsByGroup.put(role, permissions); } } } }
for (final String rawRole : section.keySet()) { final Collection<String> permissions = ImmutableList.<String>copyOf(SPLITTER.split(section.get(rawRole))); final String role = rawRole.replace("\\=", "="); permissionsByGroup.put(role, permissions);
public List<String> getAnonlist() { if (anonlist != null) { return anonlist; } else { Ini.Section section = (Ini.Section) SpringContextUtil.getBean("filterChainDefinitionClass"); anonlist = new ArrayList<>(); for (String key : section.keySet()) { if (section.get(key).equals("anon")) { anonlist.add(key); } } return anonlist; } }
Ini.Section section = ini.get(sectionName); for(String key : section.keySet()) { String value = section.get(key); LOGGER.debug(key + " = " + value);
for (final Section section : ini.getSections()) { for (final String role : section.keySet()) { final Collection<String> permissions = ImmutableList.<String>copyOf(SPLITTER.split(section.get(role))); permissionsByGroup.put(role, permissions);
for (final String rawRole : section.keySet()) { final Collection<String> permissions = ImmutableList.<String>copyOf(SPLITTER.split(section.get(rawRole))); final String role = rawRole.replace("\\=", "="); permissionsByGroup.put(role, permissions);
@Inject public KillBillOktaRealm(final SecurityConfig securityConfig) { this.securityConfig = securityConfig; this.httpClient = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(DEFAULT_TIMEOUT_SECS * 1000).build()); if (securityConfig.getShiroOktaPermissionsByGroup() != null) { final Ini ini = new Ini(); // When passing properties on the command line, \n can be escaped ini.load(securityConfig.getShiroOktaPermissionsByGroup().replace("\\n", "\n")); for (final Section section : ini.getSections()) { for (final String role : section.keySet()) { final Collection<String> permissions = ImmutableList.<String>copyOf(SPLITTER.split(section.get(role))); permissionsByGroup.put(role, permissions); } } } }
private Map<String, Set<String>> parseSection(Ini ini, String sctionName) { Map<String, Set<String>> resultMap = Maps.newHashMap(); Ini.Section sction = ini.getSection(sctionName); if (sction == null) { return resultMap; } for (String key : sction.keySet()) { String value = sction.get(key); Set<String> roles = Sets.newHashSet(); for (String role : value.split(SentryConstants.ROLE_SEPARATOR)) { if (StringUtils.isNotEmpty(role)) { roles.add(role); } } resultMap.put(key, roles); } return resultMap; }
private static String toString(String name, Ini.Section mapping) { if(mapping == null || mapping.isEmpty()) { return ""; } Joiner kvJoiner = Joiner.on(" = "); List<String> lines = Lists.newArrayList(); lines.add(NL); lines.add("[" + name + "]"); for(String key : mapping.keySet()) { lines.add(kvJoiner.join(key, mapping.get(key))); } return Joiner.on(NL).join(lines); }
Ini.Section section = ini.get("users_queries"); String query = section.get("find_max_user_id");
public static void addToList(Ini ini, String sectionName, String key, String value) { Ini.Section section = ini.get(sectionName); String currentValue = section.get(key); section.remove(key); // Otherwise the key stays on the same place in the list and references the new value too early if (currentValue == null) { section.put(key, value); } else { section.put(key, currentValue + "," + value); } } }
/** * Returns the value of the specified section property, or {@code null} if the section or property do not exist. * * @param sectionName the name of the section to retrieve to acquire the property value * @param propertyName the name of the section property for which to return the value * @return the value of the specified section property, or {@code null} if the section or property do not exist. */ public String getSectionProperty(String sectionName, String propertyName) { Section section = getSection(sectionName); return section != null ? section.get(propertyName) : null; }
/** * Returns the value of the specified section property, or {@code null} if the section or property do not exist. * * @param sectionName the name of the section to retrieve to acquire the property value * @param propertyName the name of the section property for which to return the value * @return the value of the specified section property, or {@code null} if the section or property do not exist. */ public String getSectionProperty(String sectionName, String propertyName) { Section section = getSection(sectionName); return section != null ? section.get(propertyName) : null; }