How to enable basic authentication in Searchblox windows server

It is possible to enable basic authentication in the SearchBlox server. Just follow these steps:

  1. Replace the following lines at the end of the file C:\SearchBloxServer\webapps\searchblox\WEB-INF\web.xml 

    <!-- End -->
        </web-resource-collection>   
    <auth-constraint/>
    </security-constraint>
     
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>Test Realm</realm-name>
        <form-login-config>
            <form-login-page>/search.jsp</form-login-page>
            <form-error-page>/search.jsp</form-error-page>
        </form-login-config>
    </login-config>

    with

    <url-pattern>/*</url-pattern>
              <!-- End -->
     
          </web-resource-collection>
    <auth-constraint>
               <role-name>admin-role</role-name>
           </auth-constraint>
      </security-constraint>
     
      <login-config>
          <auth-method>BASIC</auth-method>
          <realm-name>Test Realm</realm-name>     
      </login-config>

    Otherwise, download the web.xml from the link below and replace the web.xml in path C:\SearchBloxServer\webapps\searchblox\WEB-INF with the same web.xml.

    https://s3.amazonaws.com/uploads.hipchat.com/180952/1304604/i5ERugCIT2rgA0f/web.xml

  2. The default username and password are stored in a file named realm.properties under the path C:\SearchBloxServer\etc.  You can add 

    admin:admin,admin-role

    as a line in realm.properties, which means the username and password are admin, admin respectively.
  3. The password can be stored as plain text or encrypted. For each set of login credentials, add admin-role at the end of the credentials. 
  4. Follow these steps to create encrypted passwords:
    1. From the cmd prompt cd go to C:\SearchBloxServer\lib and enter the command java -cp jetty-util-9.1.3.v20140225.jar org.eclipse.jetty.util.security.Password <your username> <your password>
    2. There will be OBF, MD5, CRYPT. Copy any one of the encrypted passwords to the realm.properties file
Have more questions? Submit a request

Comments