use of com.microsoft.azure.toolkit.lib.auth.core.devicecode.DeviceCodeAccount in project azure-tools-for-java by Microsoft.
the class SignInCommandHandler method loginDeviceCodeSingle.
private static Single<DeviceCodeAccount> loginDeviceCodeSingle() {
final AzureString title = AzureOperationBundle.title("account.sign_in");
final AzureTask<DeviceCodeAccount> deviceCodeTask = new AzureTask<>(null, title, true, () -> {
final AzureAccount az = Azure.az(AzureAccount.class);
return (DeviceCodeAccount) checkCanceled(null, az.loginAsync(AuthType.DEVICE_CODE, true), () -> {
throw Lombok.sneakyThrow(new InterruptedException("user cancel"));
});
});
return AzureTaskManager.getInstance().runInBackgroundAsObservable(deviceCodeTask).toSingle();
}
use of com.microsoft.azure.toolkit.lib.auth.core.devicecode.DeviceCodeAccount in project azure-tools-for-java by Microsoft.
the class AzureSignInAction method loginDeviceCodeSingle.
private static Single<DeviceCodeAccount> loginDeviceCodeSingle() {
final AzureString title = AzureOperationBundle.title("account.sign_in");
final AzureTask<DeviceCodeAccount> deviceCodeTask = new AzureTask<>(null, title, true, () -> {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
indicator.setIndeterminate(true);
final AzureAccount az = Azure.az(AzureAccount.class);
return (DeviceCodeAccount) checkCanceled(indicator, az.loginAsync(AuthType.DEVICE_CODE, true), () -> {
throw Lombok.sneakyThrow(new InterruptedException("user cancel"));
});
});
return AzureTaskManager.getInstance().runInBackgroundAsObservable(deviceCodeTask).toSingle();
}
Aggregations