Search in sources :

Example 1 with ContentType

use of com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.ContentType in project azure-tools-for-java by Microsoft.

the class AzureAADHelper method getHttpsURLConnectionProvider.

@NotNull
private static HttpsURLConnectionProvider getHttpsURLConnectionProvider(@NotNull final String accessToken, @NotNull final RestServiceManager manager) {
    return new HttpsURLConnectionProvider() {

        @Override
        @NotNull
        public HttpsURLConnection getSSLConnection(@NotNull String managementUrl, @NotNull String path, @NotNull ContentType contentType) throws AzureCmdException {
            HttpsURLConnection sslConnection = manager.getSSLConnection(managementUrl, path, contentType);
            sslConnection.addRequestProperty(AUTHORIZATION_HEADER, "Bearer " + accessToken);
            return sslConnection;
        }
    };
}
Also used : HttpsURLConnectionProvider(com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.HttpsURLConnectionProvider) ContentType(com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.ContentType) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull) HttpsURLConnection(javax.net.ssl.HttpsURLConnection) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Example 2 with ContentType

use of com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.ContentType in project azure-tools-for-java by Microsoft.

the class AzureCertificateHelper method getHttpsURLConnectionProvider.

@NotNull
private static HttpsURLConnectionProvider getHttpsURLConnectionProvider(@NotNull final SSLSocketFactory sslSocketFactory, @NotNull final RestServiceManager manager) {
    return new HttpsURLConnectionProvider() {

        @Override
        @NotNull
        public HttpsURLConnection getSSLConnection(@NotNull String managementUrl, @NotNull String path, @NotNull ContentType contentType) throws AzureCmdException {
            HttpsURLConnection sslConnection = manager.getSSLConnection(managementUrl, path, contentType);
            sslConnection.setSSLSocketFactory(sslSocketFactory);
            return sslConnection;
        }
    };
}
Also used : HttpsURLConnectionProvider(com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.HttpsURLConnectionProvider) ContentType(com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.ContentType) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull) HttpsURLConnection(javax.net.ssl.HttpsURLConnection) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Aggregations

NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)2 ContentType (com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.ContentType)2 HttpsURLConnectionProvider (com.microsoft.tooling.msservices.helpers.azure.rest.RestServiceManager.HttpsURLConnectionProvider)2 HttpsURLConnection (javax.net.ssl.HttpsURLConnection)2