package com.qianwen.core.http; import java.io.IOException; import java.nio.charset.StandardCharsets; import okhttp3.Authenticator; import okhttp3.Credentials; import okhttp3.Request; import okhttp3.Response; import okhttp3.Route; /* loaded from: blade-starter-http-9.3.0.0-SNAPSHOT.jar:org/springblade/core/http/BaseAuthenticator.class */ public class BaseAuthenticator implements Authenticator { private final String userName; private final String password; public BaseAuthenticator(final String userName, final String password) { this.userName = userName; this.password = password; } public Request authenticate(Route route, Response response) throws IOException { String credential = Credentials.basic(this.userName, this.password, StandardCharsets.UTF_8); return response.request().newBuilder().header("Authorization", credential).build(); } }