Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class BasicAuthenticationCredential implements TokenCredential {
/**
* Basic auth user name.
*/
private final String userName;
private final String username;

/**
* Basic auth password.
Expand All @@ -28,11 +28,11 @@ public class BasicAuthenticationCredential implements TokenCredential {
/**
* Creates a basic authentication credential.
*
* @param userName basic auth user name
* @param username basic auth user name
* @param password basic auth password
*/
public BasicAuthenticationCredential(String userName, String password) {
this.userName = userName;
public BasicAuthenticationCredential(String username, String password) {
this.username = username;
this.password = password;
}

Expand All @@ -41,7 +41,7 @@ public BasicAuthenticationCredential(String userName, String password) {
*/
@Override
public Mono<AccessToken> getToken(TokenRequest request) {
String credential = userName + ":" + password;
String credential = username + ":" + password;
String encodedCredential;
try {
encodedCredential = Base64Util.encodeToString(credential.getBytes("UTF8"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ public class SimpleTokenCache {
private AccessToken cache;
private final ReplayProcessor<AccessToken> emitterProcessor = ReplayProcessor.create(1);
private final FluxSink<AccessToken> sink = emitterProcessor.sink(OverflowStrategy.BUFFER);
private final Supplier<Mono<AccessToken>> getNew;
private final Supplier<Mono<AccessToken>> tokenSupplier;

/**
* Creates an instance of RefreshableTokenCredential with default scheme "Bearer".
*
* @param getNew a method to get a new token
* @param tokenSupplier a method to get a new token
*/
public SimpleTokenCache(Supplier<Mono<AccessToken>> getNew) {
public SimpleTokenCache(Supplier<Mono<AccessToken>> tokenSupplier) {
this.wip = new AtomicBoolean(false);
this.getNew = getNew;
this.tokenSupplier = tokenSupplier;
}

/**
Expand All @@ -43,7 +43,7 @@ public Mono<AccessToken> getToken() {
}
return Mono.defer(() -> {
if (!wip.getAndSet(true)) {
return getNew.get().doOnNext(ac -> cache = ac)
return tokenSupplier.get().doOnNext(ac -> cache = ac)
.doOnNext(sink::next)
.doOnError(sink::error)
.doOnTerminate(() -> wip.set(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public enum HttpLogDetailLevel {
/**
* @return a value indicating whether a request's URL should be logged.
*/
public boolean shouldLogURL() {
public boolean shouldLogUrl() {
return this != NONE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineN
}

private Mono<Void> logRequest(final ClientLogger logger, final HttpRequest request) {
if (detailLevel.shouldLogURL()) {
if (detailLevel.shouldLogUrl()) {
logger.info("--> {} {}", request.getHttpMethod(), request.getUrl());
}

Expand Down Expand Up @@ -129,7 +129,7 @@ private Function<HttpResponse, Mono<HttpResponse>> logResponseDelegate(final Cli
}

// HttpResponseStatus responseStatus = HttpResponseStatus.valueOf(response.statusCode());
if (detailLevel.shouldLogURL()) {
if (detailLevel.shouldLogUrl()) {
logger.info("<-- {} {} ({} ms, {} body)", response.getStatusCode(), url, tookMs, bodySize);
}

Expand Down