@Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof AuthScope) {
            final AuthScope that = (AuthScope) obj;
            return Objects.equals(this.protocol, that.protocol)
                    && Objects.equals(this.host, that.host)
                    && this.port == that.port
                    && Objects.equals(this.realm, that.realm)
                    && Objects.equals(this.schemeName, that.schemeName);
        }
        return false;
    }
Tests if the authentication scopes match.

@return the match factor. Negative value signifies no match.
   Non-negative signifies a match. The greater the returned value
   the closer the match.
httpclient5/src/main/java/org/apache/hc/client5/http/auth/AuthScope.java