Search in sources :

Example 1 with DeviceCodeInfo

use of com.azure.identity.DeviceCodeInfo in project azure-gradle-plugins by microsoft.

the class GradleAuthHelper method handleDeviceCodeAccount.

private static Account handleDeviceCodeAccount(Account account) {
    if (account instanceof DeviceCodeAccount) {
        final DeviceCodeAccount deviceCodeAccount = (DeviceCodeAccount) account;
        final DeviceCodeInfo challenge = deviceCodeAccount.getDeviceCode();
        AzureMessager.getMessager().info(AzureString.format(StringUtils.replace(challenge.getMessage(), challenge.getUserCode(), "%s"), challenge.getUserCode()));
    }
    return account.continueLogin().block();
}
Also used : DeviceCodeAccount(com.microsoft.azure.toolkit.lib.auth.core.devicecode.DeviceCodeAccount) DeviceCodeInfo(com.azure.identity.DeviceCodeInfo)

Example 2 with DeviceCodeInfo

use of com.azure.identity.DeviceCodeInfo in project azure-maven-plugins by microsoft.

the class AbstractAzureMojo method handleDeviceCodeAccount.

private static Account handleDeviceCodeAccount(Account account) {
    if (account instanceof DeviceCodeAccount) {
        final DeviceCodeAccount deviceCodeAccount = (DeviceCodeAccount) account;
        final DeviceCodeInfo challenge = deviceCodeAccount.getDeviceCode();
        System.out.println(StringUtils.replace(challenge.getMessage(), challenge.getUserCode(), TextUtils.cyan(challenge.getUserCode())));
    }
    return account.continueLogin().block();
}
Also used : DeviceCodeAccount(com.microsoft.azure.toolkit.lib.auth.core.devicecode.DeviceCodeAccount) DeviceCodeInfo(com.azure.identity.DeviceCodeInfo)

Aggregations

DeviceCodeInfo (com.azure.identity.DeviceCodeInfo)2 DeviceCodeAccount (com.microsoft.azure.toolkit.lib.auth.core.devicecode.DeviceCodeAccount)2