Have Solr listen on localhost and have your web app talk to Solr. If your Solr is visible to the world, you're doing it wrong.
Edit: by saying that it's not a web-based application I mean that it shouldn't be on teh interwebz -- it's obviously a webapp in the sense that it mostly speaks HTTP.
I agree however that SOLR is best off doing one thing well, web page security can be implemented e.g. by Apache.
Or to whichever friendly consultant you decide to hire to help out with that. Wink wink. Nudge nudge.
I don't think there's anything out of the box in Solr 5.0 that changes that. SOLR-4470[0] should be able to do that, but it hasn't been committed. Apache Sentry[1] adds role based access control to Solr, but it's only been tested up to Solr 4.10 and with kerberos (not basic password protection). It comes nicely integrated out-of-the-box with Solr as part of Cloudera Search[2]; otherwise, you'll have to do some manual setup to get it to work.
[0] https://issues.apache.org/jira/browse/SOLR-4470 [1] https://sentry.incubator.apache.org/ [2] http://www.cloudera.com/content/cloudera/en/products-and-ser...
I've tried things like this
http://community.zimbra.com/documentation/w/documentation/se...
repeatedly. They never seem to work right.