@Override
            public boolean hasInfo(String name, String node, JID senderJID) throws UnauthorizedException
            {
                if (node != null) {
                    if (serverNodeProviders.get(node) != null) {
                        // Redirect the request to the disco info provider of the specified node
                        return serverNodeProviders.get(node).hasInfo(name, node, senderJID);
                    }
                    if (name != null) {
                        return XMPPServer.getInstance().getIQPEPHandler().hasInfo(name, node, senderJID);
                    }
                    // Unknown node
                    return false;
                }

                // XEP-0030, Section 8 "Security Considerations": <blockquote>The following rules apply to the handling of
                // service discovery requests sent to bare JIDs: In response to a disco#info request, the server MUST return
                // a <service-unavailable/> error if [...] The requesting entity is not authorized to receive presence from the
                // target entity (i.e., via the target having a presence subscription to the requesting entity of type "both" or
                // "from") or is not otherwise trusted (e.g., another server in a trusted network).</blockquote>
                boolean isRequestingEntityAuthorized;

                if (name == null || name.equals(senderJID.getNode())) {
                    // Entities are always authorized when querying themselves.
                    isRequestingEntityAuthorized = true;
                } else {
                    // when the target entity is an end-user, check for presence subscription state.
                    try {
                        final User user = UserManager.getInstance().getUser(name);
                        RosterItem item = user.getRoster().getRosterItem(senderJID);
                        isRequestingEntityAuthorized = item.getSubStatus() == RosterItem.SUB_FROM || item.getSubStatus() == RosterItem.SUB_BOTH;
                    } catch (UserNotFoundException e) {
                        // Not an existing user or no subscription. Response should be indistinguishable from response to a
                        // non-subscribed user.
                        isRequestingEntityAuthorized = false;
                    }
                }

                if (!isRequestingEntityAuthorized) {
                    throw new UnauthorizedException();
                }

                return true;
            }
Returns the DiscoInfoProvider responsible for providing information at the server level. This
means that this DiscoInfoProvider will provide information whenever a disco request whose
recipient JID is the server (e.g. localhost) is made.

@return the DiscoInfoProvider responsible for providing information at the server level.
xmppserver/src/main/java/org/jivesoftware/openfire/disco/IQDiscoInfoHandler.java