1、第一步:<property name="authenticate" value="true" />,true:需要认证; false:不需要认证。
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="user,admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
2、第二步:修改jetty-realm.properties文件
admin: admin123, admin
user: user, user
备注:第一个为用户名 第二个是密码 第三个是角色
本文介绍了如何使用Jetty进行身份验证配置,包括设置认证约束和修改realm文件来定义用户及角色。
3394

被折叠的 条评论
为什么被折叠?



