<security-constraint> <web-resource-collection> <web-resource-name>Admin</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name> admin </role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> </login-config> <security-role> <role-name>admin</role-name> </security-role>
<role rolename="admin"/> <user password="liyuhang" roles="admin" username="liyuhang"/>
首次訪問網站就會彈出身份驗證的輸入框,在輸入用戶名和密碼後就能夠正常訪問 網站,之後每次訪問網站的請求的頭部都會假如Authorization信息web