public class AzureAuthHelperLegacy extends Object
| Constructor and Description |
|---|
AzureAuthHelperLegacy(AuthConfiguration config)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
private static void |
assureServerExist(org.apache.maven.settings.Server server,
String serverId)
Assure the server with specified id does exist in settings.xml.
|
protected com.microsoft.azure.management.Azure.Configurable |
azureConfigure() |
protected com.microsoft.azure.credentials.ApplicationTokenCredentials |
getAppTokenCredentialsFromServer(org.apache.maven.settings.Server server)
Get ApplicationTokenCredentials from server definition in Maven settings.xml
|
protected com.microsoft.azure.management.Azure.Authenticated |
getAuthObj() |
protected com.microsoft.azure.management.Azure.Authenticated |
getAuthObjFromAzureCli()
Get Authenticated object using authentication file from Azure CLI 2.0
Note: The integrated Azure CLI in Azure Cloud Shell does not have the accessToken.json,
so we need to use MSI to authenticate in the Cloud Shell.
|
protected com.microsoft.azure.management.Azure.Authenticated |
getAuthObjFromFile(File authFile)
Get Authenticated object using file.
|
protected com.microsoft.azure.management.Azure.Authenticated |
getAuthObjFromServerId(org.apache.maven.settings.Settings settings,
String serverId)
Get Authenticated object by referencing server definition in Maven settings.xml
|
com.microsoft.azure.management.Azure |
getAzureClient() |
private static com.google.gson.JsonArray |
getAzureCliTokenList() |
protected com.microsoft.azure.AzureEnvironment |
getAzureEnvironment(String environment) |
protected com.microsoft.azure.credentials.ApplicationTokenCredentials |
getCredentialFromAzureCliWithServicePrincipal()
Get Authenticated object from token file of Azure CLI 2.0 logged with Service Principal
Note: This is a workaround for issue https://github.com/microsoft/azure-maven-plugins/issues/125
|
private static com.google.gson.JsonObject |
getDefaultSubscriptionObject() |
protected com.microsoft.rest.LogLevel |
getLogLevel() |
private static org.apache.maven.settings.Server |
getServer(org.apache.maven.settings.Settings settings,
String serverId)
Get server credential from Maven settings by server Id.
|
static String |
getSubscriptionOfCloudShell() |
private static String |
getValueFromServerConfiguration(org.apache.maven.settings.Server server,
String key)
Get string value from server configuration section in settings.xml.
|
static boolean |
isInCloudShell() |
public static final String CLIENT_ID
public static final String TENANT_ID
public static final String KEY
public static final String CERTIFICATE
public static final String CERTIFICATE_PASSWORD
public static final String ENVIRONMENT
public static final String CLOUD_SHELL_ENV_KEY
public static final String AUTH_WITH_SERVER_ID
public static final String AUTH_WITH_FILE
public static final String AUTH_WITH_AZURE_CLI
public static final String AUTH_WITH_MSI
public static final String USE_KEY_TO_AUTH
public static final String USE_CERTIFICATE_TO_AUTH
public static final String SERVER_ID_NOT_CONFIG
public static final String CLIENT_ID_NOT_CONFIG
public static final String TENANT_ID_NOT_CONFIG
public static final String KEY_NOT_CONFIG
public static final String CERTIFICATE_FILE_NOT_CONFIG
public static final String CERTIFICATE_FILE_READ_FAIL
public static final String AZURE_AUTH_INVALID
public static final String AUTH_FILE_NOT_CONFIG
public static final String AUTH_FILE_NOT_EXIST
public static final String AUTH_FILE_READ_FAIL
public static final String AZURE_CLI_AUTH_FAIL
public static final String AZURE_CLI_GET_SUBSCRIPTION_FAIL
public static final String AZURE_CLI_LOAD_TOKEN_FAIL
private static final String AZURE_FOLDER
private static final String AZURE_PROFILE_NAME
private static final String AZURE_TOKEN_NAME
protected AuthConfiguration config
public AzureAuthHelperLegacy(AuthConfiguration config)
config - public com.microsoft.azure.management.Azure getAzureClient()
protected com.microsoft.rest.LogLevel getLogLevel()
protected com.microsoft.azure.management.Azure.Configurable azureConfigure()
protected com.microsoft.azure.AzureEnvironment getAzureEnvironment(String environment)
protected com.microsoft.azure.management.Azure.Authenticated getAuthObj()
protected com.microsoft.azure.management.Azure.Authenticated getAuthObjFromServerId(org.apache.maven.settings.Settings settings,
String serverId)
settings - Settings objectserverId - Server Id to search in settings.xmlprotected com.microsoft.azure.management.Azure.Authenticated getAuthObjFromFile(File authFile)
authFile - Authentication file object.protected com.microsoft.azure.management.Azure.Authenticated getAuthObjFromAzureCli()
protected com.microsoft.azure.credentials.ApplicationTokenCredentials getCredentialFromAzureCliWithServicePrincipal()
throws IOException
IOExceptionprotected com.microsoft.azure.credentials.ApplicationTokenCredentials getAppTokenCredentialsFromServer(org.apache.maven.settings.Server server)
server - Server object from settings.xmlpublic static boolean isInCloudShell()
public static String getSubscriptionOfCloudShell() throws IOException
IOExceptionprivate static com.google.gson.JsonObject getDefaultSubscriptionObject()
throws IOException
IOExceptionprivate static com.google.gson.JsonArray getAzureCliTokenList()
throws IOException
IOExceptionprivate static org.apache.maven.settings.Server getServer(org.apache.maven.settings.Settings settings,
String serverId)
settings - Maven settings object.serverId - Server Id.private static void assureServerExist(org.apache.maven.settings.Server server,
String serverId)
throws AzureExecutionException
server - serverId - AzureExecutionExceptionprivate static String getValueFromServerConfiguration(org.apache.maven.settings.Server server, String key)
server - Server object.key - Key string.Copyright © 2020. All rights reserved.