Skip to content

Commit 9eec588

Browse files
JCJC
authored andcommitted
minor change
1 parent f006cc8 commit 9eec588

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

src/main/java/com/esri/samples/portal/oauth/OAuthController.java

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@
1818

1919
import java.text.SimpleDateFormat;
2020

21-
import com.esri.arcgisruntime.loadable.LoadStatus;
22-
import com.esri.arcgisruntime.portal.Portal;
23-
import com.esri.arcgisruntime.security.AuthenticationManager;
24-
import com.esri.arcgisruntime.security.OAuthConfiguration;
25-
2621
import javafx.fxml.FXML;
2722
import javafx.scene.control.Alert;
28-
import javafx.scene.control.Dialog;
2923
import javafx.scene.control.Label;
3024
import javafx.scene.control.TextField;
3125

26+
import com.esri.arcgisruntime.loadable.LoadStatus;
27+
import com.esri.arcgisruntime.portal.Portal;
28+
import com.esri.arcgisruntime.security.AuthenticationManager;
29+
import com.esri.arcgisruntime.security.OAuthConfiguration;
30+
3231
public class OAuthController {
3332

3433
@FXML private TextField portalURL;
@@ -55,33 +54,33 @@ void authenticate() throws Exception {
5554

5655
OAuthConfiguration configuration = authenticationDialog.getResult();
5756
// check that configuration was made
58-
if(configuration != null){
59-
AuthenticationManager.addOAuthConfiguration(configuration);
57+
if (configuration != null) {
58+
AuthenticationManager.addOAuthConfiguration(configuration);
6059

61-
// setup the handler that will prompt an authentication challenge to the user
62-
AuthenticationManager.setAuthenticationChallengeHandler(new OAuthChallengeHandler());
60+
// setup the handler that will prompt an authentication challenge to the user
61+
AuthenticationManager.setAuthenticationChallengeHandler(new OAuthChallengeHandler());
6362

64-
Portal portal = new Portal("http://" + configuration.getPortalUrl(), true);
65-
portal.addDoneLoadingListener(() -> {
66-
if (portal.getLoadStatus() == LoadStatus.LOADED) {
63+
Portal portal = new Portal("http://" + configuration.getPortalUrl(), true);
64+
portal.addDoneLoadingListener(() -> {
65+
if (portal.getLoadStatus() == LoadStatus.LOADED) {
6766

68-
// display portal user info
69-
fullName.setText(portal.getUser().getFullName());
70-
username.setText(portal.getUser().getUsername());
71-
email.setText(portal.getUser().getEmail());
72-
memberSince.setText(formatter.format(portal.getUser().getCreated().getTime()));
73-
role.setText(portal.getUser().getRole() != null ? portal.getUser().getRole().name() : "");
67+
// display portal user info
68+
fullName.setText(portal.getUser().getFullName());
69+
username.setText(portal.getUser().getUsername());
70+
email.setText(portal.getUser().getEmail());
71+
memberSince.setText(formatter.format(portal.getUser().getCreated().getTime()));
72+
role.setText(portal.getUser().getRole() != null ? portal.getUser().getRole().name() : "");
7473

75-
} else if (portal.getLoadStatus() == LoadStatus.FAILED_TO_LOAD) {
74+
} else if (portal.getLoadStatus() == LoadStatus.FAILED_TO_LOAD) {
7675

77-
// show alert message on error
78-
showMessage("Authentication failed", portal.getLoadError().getMessage(), Alert.AlertType.ERROR);
79-
}
80-
});
76+
// show alert message on error
77+
showMessage("Authentication failed", portal.getLoadError().getMessage(), Alert.AlertType.ERROR);
78+
}
79+
});
8180

82-
// loading the portal info of a secured resource
83-
// this will invoke the authentication challenge
84-
portal.loadAsync();
81+
// loading the portal info of a secured resource
82+
// this will invoke the authentication challenge
83+
portal.loadAsync();
8584
}
8685
});
8786
}

0 commit comments

Comments
 (0)