带密码和PHP的Solr http请求api
我在带密码和PHP的Solr http请求api,php,tomcat,solr,Php,Tomcat,Solr,我在tomcat\u installation\webapps\solr\WEB-INF\WEB.xml中使用以下安全设置来维护solr http请求的安全性(用户名和密码访问): <security-constraint> <web-resource-collection> <web-resource-name>Solr Lockdown</web-resource-name> <url-pattern>/</url-p
tomcat\u installation\webapps\solr\WEB-INF\WEB.xml
中使用以下安全设置来维护solr http请求的安全性(用户名和密码访问):
<security-constraint>
<web-resource-collection>
<web-resource-name>Solr Lockdown</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>solr_admin</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr</realm-name></login-config>
我使用PHPfile\u get\u contents()
来获取如下查询:
http://solr.mydomain.com/solr/wak/select?q=gaming&wt=json&indent=true
但是,应用上述安全设置将提示-或需要-用户名和密码
问题是:如何在请求URL中提供用户名和密码?或者如何在tomcat上修改solr app的安全设置以在URL中接受它们?简单如下:
http://username:password@solr.mydomain.com/solr/wak/select?q=gaming&wt=json&indent=true
但是,通常需要注意的是:基本身份验证仅采用Base64编码,因此,如果通过不安全的连接发送,则容易受到MITM攻击。我猜是因为
用户:pass@host
模式几乎可以在任何地方使用,他们只是认为很明显它也可以在这里使用。
<role rolename="solr_admin"/><user username="administ" password="theStr0ngPass!" roles="solr_admin"/>