static List<Rule> parseRules(String rules) { List<Rule> result = new ArrayList<Rule>(); String remaining = rules.trim(); while (remaining.length() > 0) { Matcher matcher = ruleParser.matcher(remaining); if (!matcher.lookingAt()) { throw new IllegalArgumentException("Invalid rule: " + remaining); } if (matcher.group(2) != null) { result.add(new Rule()); } else { result.add(new Rule(Integer.parseInt(matcher.group(4)), matcher.group(5), matcher.group(7), matcher.group(9), matcher.group(10), "g".equals(matcher.group(11)), "L".equals(matcher.group(12)))); } remaining = remaining.substring(matcher.end()); } return result; }
String base = replaceParameters(format, params); if (match == null || match.matcher(base).matches()) { if (fromPattern == null) { result = base; } else { result = replaceSubstitution(base, fromPattern, toPattern, repeat);
/** * Get the rules. * @return String of configured rules, or null if not yet configured */ public static String getRules() { String ruleString = null; if (rules != null) { StringBuilder sb = new StringBuilder(); for (Rule rule : rules) { sb.append(rule.toString()).append("\n"); } ruleString = sb.toString().trim(); } return ruleString; }
String base = replaceParameters(format, params); if (match == null || match.matcher(base).matches()) { if (fromPattern == null) { result = base; } else { result = replaceSubstitution(base, fromPattern, toPattern, repeat);
String base = replaceParameters(format, params); if (match == null || match.matcher(base).matches()) { if (fromPattern == null) { result = base; } else { result = replaceSubstitution(base, fromPattern, toPattern, repeat);
String result = r.apply(params, ruleMechanism); if (result != null) { return result;
String base = replaceParameters(format, params); if (match == null || match.matcher(base).matches()) { if (fromPattern == null) { result = base; } else { result = replaceSubstitution(base, fromPattern, toPattern, repeat);
String base = replaceParameters(format, params); if (match == null || match.matcher(base).matches()) { if (fromPattern == null) { result = base; } else { result = replaceSubstitution(base, fromPattern, toPattern, repeat);
String base = replaceParameters(format, params); if (match == null || match.matcher(base).matches()) { if (fromPattern == null) { result = base; } else { result = replaceSubstitution(base, fromPattern, toPattern, repeat);
/** * Get the translation of the principal name into an operating system * user name. * @return the short name * @throws IOException */ public String getShortName() throws IOException { String[] params; if (hostName == null) { // if it is already simple, just return it if (realm == null) { return serviceName; } params = new String[]{realm, serviceName}; } else { params = new String[]{realm, serviceName, hostName}; } for(Rule r: rules) { String result = r.apply(params); if (result != null) { return result; } } throw new NoMatchingRule("No rules applied to " + toString()); }
/** * Get the translation of the principal name into an operating system * user name. * @return the user name * @throws IOException throws if something is wrong with the rules */ public String getShortName() throws IOException { String[] params; if (hostName == null) { // if it is already simple, just return it if (realm == null) { return serviceName; } params = new String[]{realm, serviceName}; } else { params = new String[]{realm, serviceName, hostName}; } for(Rule r: rules) { String result = r.apply(params); if (result != null) { return result; } } LOG.info("No auth_to_local rules applied to {}", this); return toString(); }
/** * Get the translation of the principal name into an operating system * user name. * @return the short name * @throws IOException throws if something is wrong with the rules */ public String getShortName() throws IOException { String[] params; if (hostName == null) { // if it is already simple, just return it if (realm == null) { return serviceName; } params = new String[]{realm, serviceName}; } else { params = new String[]{realm, serviceName, hostName}; } for(Rule r: rules) { String result = r.apply(params); if (result != null) { return result; } } throw new NoMatchingRule("No rules applied to " + toString()); }
/** * Get the translation of the principal name into an operating system * user name. * @return the short name * @throws IOException throws if something is wrong with the rules */ public String getShortName() throws IOException { String[] params; if (hostName == null) { // if it is already simple, just return it if (realm == null) { return serviceName; } params = new String[]{realm, serviceName}; } else { params = new String[]{realm, serviceName, hostName}; } for(Rule r: rules) { String result = r.apply(params); if (result != null) { return result; } } throw new NoMatchingRule("No rules applied to " + toString()); }
/** * Get the translation of the principal name into an operating system * user name. * @return the user name * @throws IOException throws if something is wrong with the rules */ public String getShortName() throws IOException { String[] params; if (hostName == null) { // if it is already simple, just return it if (realm == null) { return serviceName; } params = new String[]{realm, serviceName}; } else { params = new String[]{realm, serviceName, hostName}; } for(Rule r: rules) { String result = r.apply(params); if (result != null) { return result; } } LOG.info("No auth_to_local rules applied to {}", this); return toString(); }
static List<Rule> parseRules(String rules) { List<Rule> result = new ArrayList<Rule>(); String remaining = rules.trim(); while (remaining.length() > 0) { Matcher matcher = ruleParser.matcher(remaining); if (!matcher.lookingAt()) { throw new IllegalArgumentException("Invalid rule: " + remaining); } if (matcher.group(2) != null) { result.add(new Rule()); } else { result.add(new Rule(Integer.parseInt(matcher.group(4)), matcher.group(5), matcher.group(7), matcher.group(9), matcher.group(10), "g".equals(matcher.group(11)), "L".equals(matcher.group(12)))); } remaining = remaining.substring(matcher.end()); } return result; }
static List<Rule> parseRules(String rules) { List<Rule> result = new ArrayList<Rule>(); String remaining = rules.trim(); while (remaining.length() > 0) { Matcher matcher = ruleParser.matcher(remaining); if (!matcher.lookingAt()) { throw new IllegalArgumentException("Invalid rule: " + remaining); } if (matcher.group(2) != null) { result.add(new Rule()); } else { result.add(new Rule(Integer.parseInt(matcher.group(4)), matcher.group(5), matcher.group(7), matcher.group(9), matcher.group(10), "g".equals(matcher.group(11)), "L".equals(matcher.group(12)))); } remaining = remaining.substring(matcher.end()); } return result; }
static List<Rule> parseRules(String rules) { List<Rule> result = new ArrayList<Rule>(); String remaining = rules.trim(); while (remaining.length() > 0) { Matcher matcher = ruleParser.matcher(remaining); if (!matcher.lookingAt()) { throw new IllegalArgumentException("Invalid rule: " + remaining); } if (matcher.group(2) != null) { result.add(new Rule()); } else { result.add(new Rule(Integer.parseInt(matcher.group(4)), matcher.group(5), matcher.group(7), matcher.group(9), matcher.group(10), "g".equals(matcher.group(11)), "L".equals(matcher.group(12)))); } remaining = remaining.substring(matcher.end()); } return result; }
static List<Rule> parseRules(String rules) { List<Rule> result = new ArrayList<Rule>(); String remaining = rules.trim(); while (remaining.length() > 0) { Matcher matcher = ruleParser.matcher(remaining); if (!matcher.lookingAt()) { throw new IllegalArgumentException("Invalid rule: " + remaining); } if (matcher.group(2) != null) { result.add(new Rule()); } else { result.add(new Rule(Integer.parseInt(matcher.group(4)), matcher.group(5), matcher.group(7), matcher.group(9), matcher.group(10), "g".equals(matcher.group(11)), "L".equals(matcher.group(12)))); } remaining = remaining.substring(matcher.end()); } return result; }
static List<Rule> parseRules(String rules) { List<Rule> result = new ArrayList<Rule>(); String remaining = rules.trim(); while (remaining.length() > 0) { Matcher matcher = ruleParser.matcher(remaining); if (!matcher.lookingAt()) { throw new IllegalArgumentException("Invalid rule: " + remaining); } if (matcher.group(2) != null) { result.add(new Rule()); } else { result.add(new Rule(Integer.parseInt(matcher.group(4)), matcher.group(5), matcher.group(7), matcher.group(9), matcher.group(10), "g".equals(matcher.group(11)), "L".equals(matcher.group(12)))); } remaining = remaining.substring(matcher.end()); } return result; }
/** * Get the rules. * @return String of configured rules, or null if not yet configured */ public static String getRules() { String ruleString = null; if (rules != null) { StringBuilder sb = new StringBuilder(); for (Rule rule : rules) { sb.append(rule.toString()).append("\n"); } ruleString = sb.toString().trim(); } return ruleString; }