0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Java認証Proxy対応方法

Last updated at Posted at 2021-01-31

対応方法

  1. http[s].proxyHost, http[s].proxyPortの指定
  2. Authenticator.setDefaultの設定

1.http[s].proxyHost, http[s].proxyPort, jdk.http.auth.proxying.disabledSchemes=の指定

指定箇所

以下のいずれかを実施。2番目がおすすめ。

  • 利用しているJDK,JREの/conf/net.propertiesに指定
  • 起動時のVM引数
    • -Dhttp.proxyHost
    • -Dhttp.proxyPort
    • -Dhttps.proxyHost
    • -Dhttps.proxyPort
    • jdk.http.auth.proxying.disabledSchemes= ※未指定にする

2. Authenticator.setDefaultの設定

2-1. アプリケーション起動時に以下処理を実行する

        Authenticator.setDefault(new Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(
                        System.getProperty("proxyUser"),
                        System.getProperty("proxyPassword").toCharArray());
            }
        });

2-2. 実行時にVM引数を与える

proxyUser, proxyPasswordは、VM引数に-DproxyUser=XXX-DproxyPassword=YYYとして与える。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?