Skip to content

Commit 5f9026e

Browse files
author
Max Shaposhnik
committed
CODENVY-170 rename autghorize method to authenticate
Signed-off-by: Max Shaposhnik <mshaposhnik@codenvy.com>
1 parent e6a68d6 commit 5f9026e

7 files changed

Lines changed: 32 additions & 32 deletions

File tree

core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/oauth/OAuth2Authenticator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*/
2121
public interface OAuth2Authenticator {
2222

23-
void authorize(String authenticatorUrl, AsyncCallback<OAuthStatus> callback);
23+
void authenticate(String authenticationUrl, AsyncCallback<OAuthStatus> callback);
2424

25-
Promise<OAuthStatus> authorize(String authenticationUrl);
25+
Promise<OAuthStatus> authenticate(String authenticationUrl);
2626

2727
String getProviderName();
2828
}

core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/oauth/DefaultOAuthAuthenticatorImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public DefaultOAuthAuthenticatorImpl(DialogFactory dialogFactory,
4949
}
5050

5151
@Override
52-
public void authorize(String authenticationUrl, @NotNull final AsyncCallback<OAuthStatus> callback) {
52+
public void authenticate(String authenticationUrl, @NotNull final AsyncCallback<OAuthStatus> callback) {
5353
this.authenticationUrl = authenticationUrl;
5454
this.callback = callback;
5555
showDialog();
5656
}
5757

58-
public Promise<OAuthStatus> authorize(String authenticationUrl) {
58+
public Promise<OAuthStatus> authenticate(String authenticationUrl) {
5959
this.authenticationUrl = authenticationUrl;
6060

6161
return AsyncPromiseHelper.createFromAsyncRequest(new AsyncPromiseHelper.RequestCall<OAuthStatus>() {

core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projectimport/wizard/ProjectImporter.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,23 +175,23 @@ private void tryAuthenticateRepeatImport(@NotNull final String providerName,
175175
if(authenticator == null) {
176176
authenticator = oAuth2AuthenticatorRegistry.getAuthenticator("default");
177177
}
178-
authenticator.authorize(OAuth2AuthenticatorUrlProvider.get(restContext, authenticateUrl),
179-
new AsyncCallback<OAuthStatus>() {
180-
@Override
181-
public void onFailure(Throwable caught) {
182-
callback.onFailure(new Exception(caught.getMessage()));
183-
}
184-
185-
@Override
186-
public void onSuccess(OAuthStatus result) {
187-
if (!result.equals(OAuthStatus.NOT_PERFORMED)) {
188-
doImport(pathToProject, projectName, sourceStorage);
189-
} else {
190-
subscriber.onFailure("Authentication cancelled");
191-
callback.onCompleted();
192-
}
193-
}
194-
});
178+
authenticator.authenticate(OAuth2AuthenticatorUrlProvider.get(restContext, authenticateUrl),
179+
new AsyncCallback<OAuthStatus>() {
180+
@Override
181+
public void onFailure(Throwable caught) {
182+
callback.onFailure(new Exception(caught.getMessage()));
183+
}
184+
185+
@Override
186+
public void onSuccess(OAuthStatus result) {
187+
if (!result.equals(OAuthStatus.NOT_PERFORMED)) {
188+
doImport(pathToProject, projectName, sourceStorage);
189+
} else {
190+
subscriber.onFailure("Authentication cancelled");
191+
callback.onCompleted();
192+
}
193+
}
194+
});
195195

196196
}
197197

plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public GitHubAuthenticatorImpl(GitSshKeyUploaderRegistry registry,
8282
}
8383

8484
@Override
85-
public void authorize(String authenticationUrl, @NotNull final AsyncCallback<OAuthStatus> callback) {
85+
public void authenticate(String authenticationUrl, @NotNull final AsyncCallback<OAuthStatus> callback) {
8686
this.authenticationUrl = authenticationUrl;
8787
this.callback = callback;
8888
view.showDialog();
8989
}
9090

91-
public Promise<OAuthStatus> authorize(String authenticationUrl) {
91+
public Promise<OAuthStatus> authenticate(String authenticationUrl) {
9292
this.authenticationUrl = authenticationUrl;
9393

9494
return AsyncPromiseHelper.createFromAsyncRequest(new AsyncPromiseHelper.RequestCall<OAuthStatus>() {

plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ protected void onFailRequest(PromiseError arg) {
282282
*/
283283
private void authorize() {
284284
showProcessing(true);
285-
gitHubAuthenticator.authorize(
285+
gitHubAuthenticator.authenticate(
286286
OAuth2AuthenticatorUrlProvider.get(restContext, "github", appContext.getCurrentUser().getProfile().getUserId(),
287-
Lists.asList("user", new String[] {"repo", "write:public_key"})),
287+
Lists.asList("user", new String[]{"repo", "write:public_key"})),
288288
new AsyncCallback<OAuthStatus>() {
289289
@Override
290290
public void onFailure(Throwable caught) {

plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImplTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void delegateShouldBeSet() throws Exception {
128128
@Test
129129
public void dialogShouldBeShow() throws Exception {
130130
AsyncCallback<OAuthStatus> callback = getCallBack();
131-
gitHubAuthenticator.authorize(null, callback);
131+
gitHubAuthenticator.authenticate(null, callback);
132132

133133
verify(view).showDialog();
134134
assertThat(gitHubAuthenticator.callback, is(callback));
@@ -171,7 +171,7 @@ public void onAuthenticatedWhenGenerateKeysIsNotSelected() throws Exception {
171171
when(user.getProfile()).thenReturn(profile);
172172
when(profile.getId()).thenReturn(userId);
173173

174-
gitHubAuthenticator.authorize(null, getCallBack());
174+
gitHubAuthenticator.authenticate(null, getCallBack());
175175
gitHubAuthenticator.onAuthenticated(authStatus);
176176

177177
verify(view).isGenerateKeysSelected();
@@ -198,7 +198,7 @@ public void onAuthenticatedWhenGenerateKeysIsSuccess() throws Exception {
198198
when(user.getProfile()).thenReturn(profile);
199199
when(profile.getId()).thenReturn(userId);
200200

201-
gitHubAuthenticator.authorize(null, getCallBack());
201+
gitHubAuthenticator.authenticate(null, getCallBack());
202202
gitHubAuthenticator.onAuthenticated(authStatus);
203203

204204
verify(keyProvider).uploadKey(eq(userId), generateKeyCallbackCaptor.capture());
@@ -229,7 +229,7 @@ public void onAuthenticatedWhenGenerateKeysIsFailure() throws Exception {
229229
when(profile.getId()).thenReturn(userId);
230230
when(dialogFactory.createMessageDialog(anyString(), anyString(), Matchers.<ConfirmCallback>anyObject())).thenReturn(messageDialog);
231231

232-
gitHubAuthenticator.authorize(null, getCallBack());
232+
gitHubAuthenticator.authenticate(null, getCallBack());
233233
gitHubAuthenticator.onAuthenticated(authStatus);
234234

235235
verify(keyProvider).uploadKey(eq(userId), generateKeyCallbackCaptor.capture());
@@ -266,7 +266,7 @@ public void onAuthenticatedWhenGetFailedKeyIsSuccess() throws Exception {
266266
when(pair.getName()).thenReturn(GITHUB_HOST);
267267
when(pair.getService()).thenReturn(SshKeyManagerPresenter.GIT_SSH_SERVICE);
268268

269-
gitHubAuthenticator.authorize(null, getCallBack());
269+
gitHubAuthenticator.authenticate(null, getCallBack());
270270
gitHubAuthenticator.onAuthenticated(authStatus);
271271

272272
verify(keyUploader).uploadKey(eq(userId), generateKeyCallbackCaptor.capture());

plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
420420
verify(gitHubClientService).getUserInfo();
421421
verify(gitHubClientService).getOrganizations();
422422

423-
verify(gitHubAuthenticator).authorize(anyString(), asyncCallbackCaptor.capture());
423+
verify(gitHubAuthenticator).authenticate(anyString(), asyncCallbackCaptor.capture());
424424
AsyncCallback<OAuthStatus> asyncCallback = asyncCallbackCaptor.getValue();
425425
asyncCallback.onFailure(exception);
426426

@@ -463,7 +463,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
463463
verify(gitHubClientService).getUserInfo();
464464
verify(gitHubClientService).getOrganizations();
465465

466-
verify(gitHubAuthenticator).authorize(anyString(), asyncCallbackCaptor.capture());
466+
verify(gitHubAuthenticator).authenticate(anyString(), asyncCallbackCaptor.capture());
467467
AsyncCallback<OAuthStatus> asyncCallback = asyncCallbackCaptor.getValue();
468468
asyncCallback.onSuccess(null);
469469

0 commit comments

Comments
 (0)