<div dir="ltr">Please ignore this question, just found that I need to add this line<div>" <auth-constraint><div> <role-name>user</role-name></div> </auth-constraint>"</div><div><br></div><div>to the <security-constraint> section. </div><div><br></div><div>Thank you.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 5, 2016 at 10:35 PM, Ling <span dir="ltr"><<a href="mailto:lingvisa@gmail.com" target="_blank">lingvisa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, if I want to secure the root directory, namely, when I visit <a href="http://localhost:8080/myapp" target="_blank">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't secure anything at all. I thought this should work "<url-pattern>/*</url-pattern><wbr>", but it doesn't. </div><div><br></div><div><br></div><div><div><!-- </div><div> <security-constraint></div><div> <web-resource-collection></div><div> <web-resource-name>Admins</<wbr>web-resource-name></div><div> <url-pattern>/admin/*</url-<wbr>pattern></div><div> </web-resource-collection></div><div> <auth-constraint></div><div> <role-name>admin</role-name></div><div> </auth-constraint></div><div> </security-constraint></div><div> <security-constraint></div><div> <web-resource-collection></div><div> <web-resource-name>Login</web-<wbr>resource-name></div><div> <url-pattern>/login2/*</url-<wbr>pattern></div><div> </web-resource-collection></div><div> <auth-constraint></div><div> <role-name>user</role-name></div><div> </auth-constraint></div><div> </security-constraint></div><div> --></div><div> </div><div> <security-constraint></div><div> <web-resource-collection></div><div> <span style="white-space:pre-wrap">        </span><web-resource-name>Web Root</web-resource-name></div><div> <url-pattern>/*</url-pattern></div><div> </web-resource-collection></div><div> </div><div> <!-- </div><div> <user-data-constraint></div><div> <transport-guarantee><wbr>CONFIDENTIAL</transport-<wbr>guarantee></div><div> </user-data-constraint></div><div> --></div><div> </security-constraint></div><div><br></div><div> <login-config></div><div> <auth-method>KEYCLOAK</auth-<wbr>method></div><div> <realm-name>bword</realm-name></div><div> </login-config></div></div><div><br></div></div>
</blockquote></div><br></div>