私は web.xml 構成に苦労しています これは私が持っているものです
<welcome-file-list>
<welcome-file>/jsp/index.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Unsecure pages</display-name>
<web-resource-collection>
<web-resource-name>Unsecure pages</web-resource-name>
<url-pattern>/jsp/index.jsp</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<display-name>Secure root resources</display-name>
<web-resource-collection>
<web-resource-name>Secure root resources</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>RoleA</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Specific secure recourses</display-name>
<web-resource-collection>
<web-resource-name>Specific secure recourses</web-resource-name>
<url-pattern>/home</url-pattern>
<url-pattern>/search</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>RoleA</role-name>
<role-name>RoleB</role-name>
</auth-constraint>
</security-constraint>
and in the index.jsp i have this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TITLE</title>
<meta http-equiv="REFRESH" content="0; url=/mpbo/home"></HEAD>
</HTML>
私が達成したいのは、RoleA がサイトへのフル アクセスを持ち、RoleB がホームページと検索ページにのみアクセスできるようにすることです。ホームページは RoleA と RoleB の両方のデフォルトです。
私が抱えている問題は、RoleB 内のユーザーのみです。RoleB のユーザーとして
http://localhost:8080/mpbo/
ログイン ページに移動すると、正常に動作し、/jsp/index.jsp (ウェルカム ファイル) にリダイレクトされます。 ) /mpbo/home フォルダーにリダイレクトしようとしますが、ここでアクセスが拒否されます。ログイン後に /mpbo/home フォルダを直接参照すると成功します /jsp/index.jsp ファイルを直接参照すると、/mpbo/home ページに正常にリダイレクトされます
したがって、問題は実際の / に制約があることだと思います。/ のみで制約なし、さらには RoleA と RoleB を使用して URL パターンを追加しようとしましたが、どちらも機能しませんでした。
これを機能させる方法はありますか?