次のセクションでは、すべてのクライアントに https 接続を使用するよう強制する必要があります。
<security-constraint>
<web-resource-collection>
<web-resource-name>securedapp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
実際には、index.html ページのみが ssl によって保護されます。したがって、次のようなリクエストhttp://localhost/JAX-RS_Service/
がリダイレクトされhttps://localhost/JAX-RS_Service/
、index.html ページが表示されます。同じことですが、http://localhost/JAX-RS_Service/index.html
リクエストしようとするとhttp://localhost/JAX-RS_Service/services/customers/1
、https へのリダイレクトがないため、すべてがプレーンテキストで送信されます。
認証を強制する場合も同様です
<security-constraint>
<web-resource-collection>
<web-resource-name>Authenticated customers only</web-resource-name>
<url-pattern>/services/customers/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>CUST</role-name>
</auth-constraint>
</security-constraint>
のような URL パターン<url-pattern>/services/*</url-pattern>
は機能しません。
がサブロケーションで機能しないのはなぜ<url-pattern>/*</url-pattern>
ですか。これを修正する方法はありますか?