class AuthzHelper {

    public static boolean shouldRunDelegatedTrustCheck(final String trust, final String trustDomain) {

        // if no trust field field then no delegated trust check

        if (trust == null) {
            return false;
        }

        // if no specific trust domain specifies then we need
        // run the delegated trust check for this domain

        if (trustDomain == null) {
            return true;
        }

        // otherwise we'll run the delegated trust check only if
        // domain name matches

        return trust.equalsIgnoreCase(trustDomain);
    }

}