Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>myRealm</realm-name>
    </login-config>

IP authorization

To restrict the access for specific hosts you have to define an IPAccessHandler in your jetty.xml:

Code Block

    <Get id="oldhandler" name="handler" />
    <Set name="handler">
        <New class="org.eclipse.jetty.server.handler.IPAccessHandler">
            <Set name="handler"><Ref id="oldhandler"/></Set>
            <Set name="white">     
                <Array type="java.lang.String">
                    <Item>127.0.0.1</Item>    
                </Array>
            </Set>
        </New>
    </Set>

It is important to store the given handlers in the local variable oldhandler to set them as the handler for the IPAccessHandler (see Jetty handler concept for more details).
You can define a whitelist (as in the sample above) or a blacklist. The IPAccessHandler does not allow to use alias names to point to specific IPs.