以下のコードを web.xml に貼り付けて、特定のアドレスの基本認証用に apache tomcat web.xml を構成しました。
<security-constraint>
<web-resource-collection>
<web-resource-name>
Protected Site
</web-resource-name>
<!-- This would protect the entire site -->
<url-pattern> /Documents/* </url-pattern>
<!-- If you list http methods,
only those methods are protected -->
<http-method> DELETE </http-method>
<http-method> GET </http-method>
<http-method> POST </http-method>
<http-method> PUT </http-method>
</web-resource-collection>
<auth-constraint>
<!-- Roles that have access -->
<role-name>role1</role-name>
</auth-constraint>
</security-constraint>
<!-- BASIC authentication -->
<login-config>
<auth-method> BASIC </auth-method>
<realm-name>Authentication </realm-name>
</login-config>
<!-- Define security roles -->
<security-role>
<description> Test role </description>
<role-name>role1</role-name>
</security-role>
ユーザー名とパスワードを取得するためのブラウザの基本認証ダイアログが表示されました。正しいユーザー名とパスワードの後、私は認証され、そうでなければドキュメントを見ることができます。
これですべてが正常に動作しますが、「Adobe flex プログラミングを使用してこの認証をバイパスしたい、つまり、flex コードでユーザー名 N パスワードを指定することで、このダイアログが表示されないようにし、ユーザーがコードによって認証されるようにしたい。」