@@ -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 ();
0 commit comments