WebSphere Application Server は、Web アプリケーションに JavaEE セキュリティー・コンテキストを使用するように構成した場合にのみ、プリンシパルとリモート・ユーザーを返します。web.xml を編集して、次のようなものを含めます
<security-constraint>
<display-name>userConstraint</display-name>
<web-resource-collection>
<web-resource-name>secure</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description>user</description>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>secrole</description>
<role-name>user</role-name>
</security-role>
アプリケーションを再デプロイします。アプリケーションをデプロイしたら、管理コンソールでアプリケーションの設定を確認してください。「ユーザー/役割のマッピング」に気付くでしょう。新しく追加された役割に「信頼されたレルムからのすべての認証済みユーザー」を追加します。アプリケーションを再起動します。
その後、匿名ユーザーはアプリケーションにアクセスできなくなります。また、getRemoteUser およびその他の API は、適切にユーザーを返します。