/** * @return builds a StandardNiFiUser from the current state of the builder */ public StandardNiFiUser build() { return new StandardNiFiUser(this); } }
@Override public String toString() { final String formattedGroups; if (groups == null) { formattedGroups = "none"; } else { formattedGroups = StringUtils.join(groups, ", "); } return String.format("identity[%s], groups[%s]", getIdentity(), formattedGroups); }
/** * Returns a regular user populated with the provided values, or if the user should be anonymous, a well-formed instance of the anonymous user with the provided values. * * @param identity the user's identity * @param chain the proxied entities * @param clientAddress the requesting IP address * @param isAnonymous if true, an anonymous user will be returned (identity will be ignored) * @return the populated user */ protected static NiFiUser createUser(String identity, Set<String> groups, NiFiUser chain, String clientAddress, boolean isAnonymous) { if (isAnonymous) { return StandardNiFiUser.populateAnonymousUser(chain, clientAddress); } else { return new Builder().identity(identity).groups(groups).chain(chain).clientAddress(clientAddress).build(); } }
/** * Returns a regular user populated with the provided values, or if the user should be anonymous, a well-formed instance of the anonymous user with the provided values. * * @param identity the user's identity * @param chain the proxied entities * @param clientAddress the requesting IP address * @param isAnonymous if true, an anonymous user will be returned (identity will be ignored) * @return the populated user */ protected static NiFiUser createUser(String identity, Set<String> groups, NiFiUser chain, String clientAddress, boolean isAnonymous) { if (isAnonymous) { return StandardNiFiUser.populateAnonymousUser(chain, clientAddress); } else { return new Builder().identity(identity).groups(groups).chain(chain).clientAddress(clientAddress).build(); } }