Skip to content

Commit abdd5d8

Browse files
committed
Rename method.
1 parent a9de376 commit abdd5d8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2AuthorizationService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public OAuthTokens validate(final OAuthTokens saved) throws BackgroundException
130130
log.warn("Refresh expired tokens {}", saved);
131131
// Refresh expired tokens
132132
try {
133-
final OAuthTokens refreshed = this.refresh(saved);
133+
final OAuthTokens refreshed = this.authorizeWithRefreshToken(saved);
134134
log.debug("Refreshed tokens {} for {}", refreshed, host);
135135
return this.save(refreshed);
136136
}
@@ -195,7 +195,7 @@ public OAuthTokens authorize() throws BackgroundException {
195195
// Save access token, refresh token and id token
196196
switch(flowType) {
197197
case AuthorizationCode:
198-
response = this.authorizeWithCode(host, prompt);
198+
response = this.authorizeWithCode(prompt);
199199
break;
200200
case PasswordGrant:
201201
response = this.authorizeWithPassword(credentials);
@@ -209,10 +209,10 @@ public OAuthTokens authorize() throws BackgroundException {
209209
System.currentTimeMillis() + response.getExpiresInSeconds() * 1000, response.getIdToken());
210210
}
211211

212-
private IdTokenResponse authorizeWithCode(final Host bookmark, final LoginCallback prompt) throws BackgroundException {
212+
private IdTokenResponse authorizeWithCode(final LoginCallback prompt) throws BackgroundException {
213213
log.debug("Request tokens with code");
214-
if(HostPreferencesFactory.get(bookmark).getBoolean("oauth.browser.open.warn")) {
215-
prompt.warn(bookmark,
214+
if(HostPreferencesFactory.get(host).getBoolean("oauth.browser.open.warn")) {
215+
prompt.warn(host,
216216
LocaleFactory.localizedString("Provide additional login credentials", "Credentials"),
217217
new StringAppender()
218218
.append(LocaleFactory.localizedString("Open web browser to authenticate and obtain an authorization code", "Credentials"))
@@ -246,7 +246,7 @@ private IdTokenResponse authorizeWithCode(final Host bookmark, final LoginCallba
246246
final String authorizationCodeUrl = authorizationCodeUrlBuilder.build();
247247
log.debug("Open browser with URL {}", authorizationCodeUrl);
248248
final String authorizationCode = OAuth2AuthorizationCodeProviderFactory.get().prompt(
249-
bookmark, prompt, authorizationCodeUrl, redirectUri, state);
249+
host, prompt, authorizationCodeUrl, redirectUri, state);
250250
if(StringUtils.isBlank(authorizationCode)) {
251251
throw new LoginCanceledException();
252252
}
@@ -295,7 +295,7 @@ private IdTokenResponse authorizeWithPassword(final Credentials credentials) thr
295295
}
296296
}
297297

298-
public OAuthTokens refresh(final OAuthTokens tokens) throws BackgroundException {
298+
public OAuthTokens authorizeWithRefreshToken(final OAuthTokens tokens) throws BackgroundException {
299299
if(StringUtils.isBlank(tokens.getRefreshToken())) {
300300
log.warn("Missing refresh token in {}", tokens);
301301
return this.authorize();

oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2ErrorResponseInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public boolean retryRequest(final HttpResponse response, final int executionCoun
4242
case HttpStatus.SC_UNAUTHORIZED:
4343
try {
4444
log.warn("Attempt to refresh OAuth tokens for failure {}", response);
45-
service.save(service.refresh(host.getCredentials().getOauth()));
45+
service.save(service.authorizeWithRefreshToken(host.getCredentials().getOauth()));
4646
// Try again
4747
return true;
4848
}

oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2RequestInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void process(final HttpRequest request, final HttpContext context) throws
7272
final OAuthTokens tokens = host.getCredentials().getOauth();
7373
if(tokens.isExpired()) {
7474
try {
75-
this.save(this.refresh(tokens));
75+
this.save(this.authorizeWithRefreshToken(tokens));
7676
}
7777
catch(BackgroundException e) {
7878
log.warn("Failure {} refreshing OAuth tokens {}", e, tokens);

0 commit comments

Comments
 (0)