在配置好acegi的那些filter之类什么的之后,建立index.jsp、login.jsp、order/authorizeOrder.jsp、order/createOrder.jsp文件,按照之前的配置,权限分配是:
/index.jsp=ROLE_ADMIN,ROLE_TECHNICIAN
/order/createOrder.jsp=ROLE_TECHNICIAN
/order/authorizeOrder.jsp=ROLE_ADMIN
/login.jsp=ROLE_ANONYMOUS,ROLE_TECHNICIAN,ROLE_ADMIN
login.jsp的form:
<form action="<c:url value='j_acegi_security_check'/>" method="POST">
<table width=50% border=0 align="center">
<tr>
<td>User:</td>
<td><input type='text' name='j_username'
</td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='j_password'></td>
</tr>
<tr>
<td colspan='2'><input name="submit" type="submit">
<input name="reset" type="reset" value="Clear"></td>
</tr>
</table>
</div>
</div>
</form>
使用相应的用户名登录后即可有相应的权限,否则重新转到登录页面。
本文介绍了一个基于ACEGI的安全配置案例,定义了不同角色对于特定页面的访问权限,并展示了登录表单的具体实现。
1610

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



