<div dir="ltr">Hi, if I want to secure the root directory, namely, when I visit <a href="http://localhost:8080/myapp">http://localhost:8080/myapp</a>, then it redirects me to the keycloak login page, asking for credentials. How to achieve that?<div><br></div><div>I modified the Web.xml as follows, but it doesn&#39;t secure anything at all. I thought this should work &quot;&lt;url-pattern&gt;/*&lt;/url-pattern&gt;&quot;, but it doesn&#39;t. </div><div><br></div><div><br></div><div><div>&lt;!-- </div><div>    &lt;security-constraint&gt;</div><div>        &lt;web-resource-collection&gt;</div><div>            &lt;web-resource-name&gt;Admins&lt;/web-resource-name&gt;</div><div>            &lt;url-pattern&gt;/admin/*&lt;/url-pattern&gt;</div><div>        &lt;/web-resource-collection&gt;</div><div>        &lt;auth-constraint&gt;</div><div>            &lt;role-name&gt;admin&lt;/role-name&gt;</div><div>        &lt;/auth-constraint&gt;</div><div>    &lt;/security-constraint&gt;</div><div>    &lt;security-constraint&gt;</div><div>        &lt;web-resource-collection&gt;</div><div>            &lt;web-resource-name&gt;Login&lt;/web-resource-name&gt;</div><div>            &lt;url-pattern&gt;/login2/*&lt;/url-pattern&gt;</div><div>        &lt;/web-resource-collection&gt;</div><div>        &lt;auth-constraint&gt;</div><div>            &lt;role-name&gt;user&lt;/role-name&gt;</div><div>        &lt;/auth-constraint&gt;</div><div>    &lt;/security-constraint&gt;</div><div> --&gt;</div><div>    </div><div>    &lt;security-constraint&gt;</div><div>        &lt;web-resource-collection&gt;</div><div>        <span class="" style="white-space:pre">        </span>&lt;web-resource-name&gt;Web Root&lt;/web-resource-name&gt;</div><div>            &lt;url-pattern&gt;/*&lt;/url-pattern&gt;</div><div>        &lt;/web-resource-collection&gt;</div><div>      </div><div> &lt;!-- </div><div>        &lt;user-data-constraint&gt;</div><div>            &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;</div><div>        &lt;/user-data-constraint&gt;</div><div>         --&gt;</div><div>    &lt;/security-constraint&gt;</div><div><br></div><div>    &lt;login-config&gt;</div><div>        &lt;auth-method&gt;KEYCLOAK&lt;/auth-method&gt;</div><div>        &lt;realm-name&gt;bword&lt;/realm-name&gt;</div><div>    &lt;/login-config&gt;</div></div><div><br></div></div>