【发布时间】:2019-03-27 03:44:44
【问题描述】:
我已在生产服务器中安装了 solr 7.7 独立版。我正在尝试使用码头方法设置身份验证机制。这是我尝试过的:
1.修改“/opt/solr/server/etc/jetty.xml
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
-
在 /opt/solr/server/etc/realm.properties 中创建凭据文件
admin: admin123,core -
修改/opt/solr/server/etc/webdefault.xml
<security-constraint> <web-resource-collection> <web-resource-name>Solr authenticated application</web-resource-name> <url-pattern>/</url-pattern> </web-resource-collection> <auth-constraint> <role-name>core</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>Test Realm</realm-name> </login-config>
在此之后如果我重新启动 solr 服务,则 solr 不会启动。在日志中,我收到以下错误:
Suppressed: java.lang.NoSuchFieldException: refreshInterval
Suppressed: java.lang.NoSuchFieldException: TYPE
Suppressed: java.lang.NoSuchMethodException: org.eclipse.jetty.security.HashLoginService.setRefreshInterval(java.lang.String)
【问题讨论】:
-
有什么理由你不是using the built-in authentication?
-
我在错误的地方创建了 security.json。这就是为什么它不起作用。现在我可以让它工作了。