Search in sources :

Example 1 with Authenticated

use of com.microsoft.azure.management.Azure.Authenticated in project azure-gradle-plugins by lenala.

the class AzureAuthHelper method getAuthObjFromConfiguration.

/**
 * Get Authenticated object by reading app token credentials from gradle.properties
 *
 * @return Authenticated object if configurations are correct; otherwise return null.
 */
protected Authenticated getAuthObjFromConfiguration(final AuthConfiguration config) {
    final ApplicationTokenCredentials credential = getAppTokenCredentials();
    if (credential == null) {
        return null;
    }
    final Authenticated auth = azureConfigure().authenticate(credential);
    if (auth != null) {
        logger.quiet(AUTH_WITH_CLIENT_ID + config.getAuthenticationSetting(CLIENT_ID));
    }
    return auth;
}
Also used : Authenticated(com.microsoft.azure.management.Azure.Authenticated) ApplicationTokenCredentials(com.microsoft.azure.credentials.ApplicationTokenCredentials)

Example 2 with Authenticated

use of com.microsoft.azure.management.Azure.Authenticated in project azure-gradle-plugins by lenala.

the class AzureAuthHelper method getAuthObj.

protected Authenticated getAuthObj() {
    Authenticated auth;
    // check if project has Azure authentication settings in build.gradle or gradle.properties
    boolean hasAuthSetting = config.hasAuthenticationSettings();
    if (hasAuthSetting) {
        auth = getAuthObjFromConfiguration(config);
        if (auth == null) {
            auth = getAuthObjFromFile(new File(config.getAuthFile()));
        }
    } else {
        auth = getAuthObjFromAzureCli();
    }
    return auth;
}
Also used : Authenticated(com.microsoft.azure.management.Azure.Authenticated) File(java.io.File)

Example 3 with Authenticated

use of com.microsoft.azure.management.Azure.Authenticated in project azure-gradle-plugins by lenala.

the class AzureAuthHelper method getAuthObjFromConfiguration.

/**
 * Get Authenticated object by reading app token credentials from gradle.properties
 *
 * @return Authenticated object if configurations are correct; otherwise return null.
 */
private Authenticated getAuthObjFromConfiguration(final AuthConfiguration config) {
    final ApplicationTokenCredentials credential = getAppTokenCredentials();
    if (credential == null) {
        return null;
    }
    final Authenticated auth = azureConfigure().authenticate(credential);
    if (auth != null) {
        logger.quiet(AUTH_WITH_CLIENT_ID + config.getAuthenticationSetting(CLIENT_ID));
    }
    return auth;
}
Also used : Authenticated(com.microsoft.azure.management.Azure.Authenticated) ApplicationTokenCredentials(com.microsoft.azure.credentials.ApplicationTokenCredentials)

Example 4 with Authenticated

use of com.microsoft.azure.management.Azure.Authenticated in project azure-gradle-plugins by lenala.

the class AzureAuthHelper method getAuthObj.

private Authenticated getAuthObj() {
    Authenticated auth;
    // check if project has Azure authentication settings in build.gradle or gradle.properties
    boolean hasAuthSetting = config.hasAuthenticationSettings();
    if (hasAuthSetting) {
        auth = getAuthObjFromConfiguration(config);
        if (auth == null) {
            auth = getAuthObjFromFile(new File(config.getAuthFile()));
        }
    } else {
        auth = getAuthObjFromAzureCli();
    }
    return auth;
}
Also used : Authenticated(com.microsoft.azure.management.Azure.Authenticated) File(java.io.File)

Aggregations

Authenticated (com.microsoft.azure.management.Azure.Authenticated)4 ApplicationTokenCredentials (com.microsoft.azure.credentials.ApplicationTokenCredentials)2 File (java.io.File)2