Skip to content

Commit 81976d8

Browse files
authored
Use device login as the auth method for create service principal (#2946)
1 parent 9d9da84 commit 81976d8

File tree

1 file changed

+12
-12
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azuretools/ijidea/ui

1 file changed

+12
-12
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azuretools/ijidea/ui/SignInWindow.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ private void doSelectCredFilepath() {
170170
FileChooserDescriptor fileDescriptor = FileChooserDescriptorFactory.createSingleFileDescriptor("azureauth");
171171
fileDescriptor.setTitle("Select Authentication File");
172172
final VirtualFile file = FileChooser.chooseFile(
173-
fileDescriptor,
174-
this.project,
175-
LocalFileSystem.getInstance().findFileByPath(System.getProperty("user.home"))
173+
fileDescriptor,
174+
this.project,
175+
LocalFileSystem.getInstance().findFileByPath(System.getProperty("user.home"))
176176
);
177177
if (file != null) {
178178
authFileTextField.setText(file.getPath());
@@ -270,16 +270,16 @@ private void doSignOut() {
270270
}
271271

272272
private void doCreateServicePrincipal() {
273-
AdAuthManager adAuthManager = null;
273+
DCAuthManager dcAuthManager = null;
274274
try {
275-
adAuthManager = AdAuthManager.getInstance();
276-
if (adAuthManager.isSignedIn()) {
277-
adAuthManager.signOut();
275+
dcAuthManager = DCAuthManager.getInstance();
276+
if (dcAuthManager.isSignedIn()) {
277+
dcAuthManager.signOut();
278278
}
279279

280-
signInAsync();
280+
doDeviceLogin();
281281

282-
if (!adAuthManager.isSignedIn()) {
282+
if (!dcAuthManager.isSignedIn()) {
283283
// canceled by the user
284284
System.out.println(">> Canceled by the user");
285285
return;
@@ -336,7 +336,7 @@ public void run() {
336336
}
337337
}
338338

339-
SrvPriCreationStatusDialog d1 = SrvPriCreationStatusDialog.go(tidSidsMap, destinationFolder, project);
339+
SrvPriCreationStatusDialog d1 = SrvPriCreationStatusDialog.go(tidSidsMap, destinationFolder, project);
340340
if (d1 == null) {
341341
System.out.println(">> Canceled by the user");
342342
return;
@@ -356,10 +356,10 @@ public void run() {
356356
ErrorWindow.show(project, ex.getMessage(), "Get Subscription Error");
357357

358358
} finally {
359-
if (adAuthManager != null) {
359+
if (dcAuthManager != null) {
360360
try {
361361
System.out.println(">> Signing out...");
362-
adAuthManager.signOut();
362+
dcAuthManager.signOut();
363363
} catch (Exception e) {
364364
e.printStackTrace();
365365
}

0 commit comments

Comments
 (0)