Last active
March 27, 2020 18:10
-
-
Save jstrassburg/9777027 to your computer and use it in GitHub Desktop.
Solr Jetty Authorization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> | |
<Configure id="Server" class="org.eclipse.jetty.server.Server"> | |
<!-- only the relevant addition is listed here --> | |
<Call name="addBean"> | |
<Arg> | |
<New class="org.eclipse.jetty.security.HashLoginService"> | |
<Set name="name">MySolrRealm</Set> | |
<Set name="config"> | |
<SystemProperty name="jetty.home" default="."/>/etc/realm.properties | |
</Set> | |
<Set name="refreshInterval">0</Set> | |
</New> | |
</Arg> | |
</Call> | |
</Configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defines users that can access the web (console, demo, etc.) | |
# username: password [,rolename ...] | |
# | |
# To hash a password run the following command from the solr-4.1.0/[instanceName]/lib/ directory | |
# which contains jetty-util-8.1.8.v20121106.jar referenced below: | |
# | |
# C:\> java -cp jetty-util-8.1.8.v20121106.jar org.eclipse.jetty.util.security.Password accountName password | |
solradmin: MD5:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,adminrole,updaterole | |
solrupdate: MD5:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,updaterole |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="ISO-8859-1"?> | |
<web-app | |
xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
metadata-complete="true" | |
version="2.5"> | |
<!-- only the relevant addition is listed here --> | |
<login-config> | |
<auth-method>BASIC</auth-method> | |
<realm-name>MySolrRealm</realm-name> | |
</login-config> | |
<security-constraint> | |
<web-resource-collection> | |
<web-resource-name>Disable TRACE</web-resource-name> | |
<url-pattern>/</url-pattern> | |
<http-method>TRACE</http-method> | |
</web-resource-collection> | |
<auth-constraint/> | |
</security-constraint> | |
<security-constraint> | |
<web-resource-collection> | |
<web-resource-name>Admin Auth</web-resource-name> | |
<url-pattern>/admin/*</url-pattern> | |
</web-resource-collection> | |
<auth-constraint> | |
<role-name>adminrole</role-name> | |
</auth-constraint> | |
</security-constraint> | |
<security-constraint> | |
<web-resource-collection> | |
<web-resource-name>Data Import Auth</web-resource-name> | |
<url-pattern>/dataimport/*</url-pattern> | |
<url-pattern>/myCollection1/dataimport/*</url-pattern> | |
<url-pattern>/myCollection2/dataimport/*</url-pattern> | |
</web-resource-collection> | |
<auth-constraint> | |
<role-name>updaterole</role-name> | |
</auth-constraint> | |
</security-constraint> | |
<security-constraint> | |
<web-resource-collection> | |
<web-resource-name>Update Auth</web-resource-name> | |
<url-pattern>/update/*</url-pattern> | |
<url-pattern>/myCollection1/update/*</url-pattern> | |
<url-pattern>/myCollection2/update/*</url-pattern> | |
</web-resource-collection> | |
<auth-constraint> | |
<role-name>updaterole</role-name> | |
</auth-constraint> | |
</security-constraint> | |
</web-app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got nothing when I login,do you have any ideas about it,(I am following your guide)