String apply(String[] params) throws IOException {
        String result = null;
        if (isDefault) {
            if (defaultRealm.equals(params[0])) {
                result = params[1];
            }
        } else if (params.length - 1 == numOfComponents) {
            String base = replaceParameters(format, params);
            if (match == null || match.matcher(base).matches()) {
                if (fromPattern == null) {
                    result = base;
                } else {
                    result = replaceSubstitution(base, fromPattern, toPattern,  repeat);
                }
            }
        }
        if (result != null && NON_SIMPLE_PATTERN.matcher(result).find()) {
            throw new NoMatchingRule("Non-simple name " + result + " after auth_to_local rule " + this);
        }
        if (toLowerCase && result != null) {
            result = result.toLowerCase(Locale.ENGLISH);
        } else if (toUpperCase && result != null) {
            result = result.toUpperCase(Locale.ENGLISH);
        }

        return result;
    }
Try to apply this rule to the given name represented as a parameter
array.
@param params first element is the realm, second and later elements are
       are the components of the name "a/b@FOO" -> {"FOO", "a", "b"}
@return the short name if this rule applies or null
@throws IOException throws if something is wrong with the rules
clients/src/main/java/org/apache/kafka/common/security/kerberos/KerberosRule.java