public class BasicAuthenticationInterceptor extends ObjectSE implements ClientHttpRequestInterceptor
Authorization
ヘッダーがすでに設定されていない限り、特定の HTTP 基本認証のユーザー名 / パスワードのペアを適用する ClientHttpRequestInterceptor
。HttpHeaders.setBasicAuth(java.lang.String, java.lang.String)
, HttpHeaders.AUTHORIZATION
コンストラクターと説明 |
---|
BasicAuthenticationInterceptor(StringSE username, StringSE password) 指定されたユーザー名とパスワードに基本認証を追加する新しいインターセプターを作成します。 |
BasicAuthenticationInterceptor(StringSE username, StringSE password, CharsetSE charset) 指定された文字セットを使用してエンコードされた、指定されたユーザー名とパスワードの基本認証を追加する新しいインターセプターを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
ClientHttpResponse | intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) 指定されたリクエストをインターセプトし、レスポンスを返します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public BasicAuthenticationInterceptor(StringSE username, StringSE password)
username
- 使用するユーザー名 password
- 使用するパスワード HttpHeaders.setBasicAuth(String, String)
, HttpHeaders.encodeBasicAuth(String, String, Charset)
public BasicAuthenticationInterceptor(StringSE username, StringSE password, @Nullable CharsetSE charset)
username
- 使用するユーザー名 password
- 使用するパスワード charset
- 使用する文字セット HttpHeaders.setBasicAuth(String, String, Charset)
, HttpHeaders.encodeBasicAuth(String, String, Charset)
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOExceptionSE
ClientHttpRequestInterceptor
ClientHttpRequestExecution
により、インターセプターはチェーン内の次のエンティティにリクエストとレスポンスを渡すことができます。このメソッドの典型的な実装は、次のパターンに従います。
ClientHttpRequestExecution.execute(org.springframework.http.HttpRequest, byte[])
を使用してリクエストを実行 ClientHttpRequestInterceptor
の intercept
request
- メソッド、URI、ヘッダーを含むリクエスト body
- リクエストの本文 execution
- リクエストの実行 IOExceptionSE
- I/O エラーの場合