1
我在码头配置基本认证问题 这里是我的web.xml将安全嵌入码头
<security-constraint>
<web-resource-collection>
<web-resource-name>resources</web-resource-name>
<url-pattern>/resources/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>MyRealm</realm-name>
</login-config>
<security-role>
<role-name>user</role-name>
</security-role>
,这里是我的Java代码,我尝试添加login服务
HashLoginService myrealm = new HashLoginService("MyRealm");
myrealm.setConfig("src/main/resources/jetty-realm.properties");
root.getSecurityHandler().setLoginService(myrealm);
我的jetty-realm.properties文件有以下用户
user: Lag976JGQdeosfQM,user
我可以建立连接但我无法进行身份验证,而且我现在已经陷入了很长一段时间,所以无论谁帮助我,都可以免费获得数字啤酒! ;)
什么是'root'参数?我应该把这里面'contextInitialized()'? – Halil