httpservices/src/main/java/ucar/httpservices/HTTPSession.java
public HTTPSession setCredentialsProvider(CredentialsProvider provider, AuthScope scope)
            throws HTTPException
    {
        if(provider == null)
            throw new NullPointerException(this.getClass().getName());
        if(scope == null)
            scope = AuthScope.ANY;
        localcreds.put(scope, provider);
        return this;
    }
public HTTPSession setCredentialsProvider(CredentialsProvider provider, AuthScope scope)
            throws HTTPException
    {
        if(provider == null)
            throw new NullPointerException(this.getClass().getName());
        if(scope == null)
            scope = AuthScope.ANY;
        localcreds.put(scope, provider);
        return this;
    }
This is the most general case

@param provider the credentials provider
@param scope    where to use it (i.e. on what host+port)
@throws HTTPException