com.microsoft.rest.credentials.ServiceClientCredentials Java Examples
The following examples show how to use
com.microsoft.rest.credentials.ServiceClientCredentials.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EcKeyIntegrationTests.java From azure-keyvault-java with MIT License | 6 votes |
private static ServiceClientCredentials createTestCredentials() throws Exception { return new KeyVaultCredentials() { @Override public String doAuthenticate(String authorization, String resource, String scope) { try { if (isRecordMode()) { AuthenticationResult authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } else { return ""; } } catch (Exception ex) { throw new RuntimeException(ex); } } }; }
Example #2
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #3
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #4
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #5
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #6
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #7
Source File: KeyVaultClientIntegrationTestBase.java From azure-keyvault-java with MIT License | 6 votes |
private static ServiceClientCredentials createTestCredentials() throws Exception { return new KeyVaultCredentials() { @Override public String doAuthenticate(String authorization, String resource, String scope) { try { if (isRecordMode()) { AuthenticationResult authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } else { return ""; } } catch (Exception ex) { throw new RuntimeException(ex); } } }; }
Example #8
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #9
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #10
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #11
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #12
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #13
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #14
Source File: KeyVault.java From remote-monitoring-services-java with MIT License | 6 votes |
/** * Creates a new KeyVaultCredential based on the access token obtained. * * @return */ private ServiceClientCredentials createCredentials() { return new KeyVaultCredentials() { //Callback that supplies the token type and access token on request. @Override public String doAuthenticate(String authorization, String resource, String scope) { AuthenticationResult authResult; try { authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } catch (Exception e) { // TODO: Add logging log.error("Failed to get the saccess token for accessing the keyvault.", e); // e.printStackTrace(); } return ""; } }; }
Example #15
Source File: KeyVault.java From remote-monitoring-services-java with MIT License | 6 votes |
/** * Creates a new KeyVaultCredential based on the access token obtained. * * @return */ private ServiceClientCredentials createCredentials() { return new KeyVaultCredentials() { //Callback that supplies the token type and access token on request. @Override public String doAuthenticate(String authorization, String resource, String scope) { AuthenticationResult authResult; try { authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } catch (Exception e) { log.error("Failed to get authentication token for key vault.",e); // e.printStackTrace(); } return ""; } }; }
Example #16
Source File: KeyVault.java From remote-monitoring-services-java with MIT License | 6 votes |
/** * Creates a new KeyVaultCredential based on the access token obtained. * * @return */ private ServiceClientCredentials createCredentials() { return new KeyVaultCredentials() { //Callback that supplies the token type and access token on request. @Override public String doAuthenticate(String authorization, String resource, String scope) { AuthenticationResult authResult; try { authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } catch (Exception e) { log.error("Failed to get authentication token for key vault.",e); // e.printStackTrace(); } return ""; } }; }
Example #17
Source File: KeyVault.java From remote-monitoring-services-java with MIT License | 6 votes |
/** * Creates a new KeyVaultCredential based on the access token obtained. * * @return */ private ServiceClientCredentials createCredentials() { return new KeyVaultCredentials() { //Callback that supplies the token type and access token on request. @Override public String doAuthenticate(String authorization, String resource, String scope) { AuthenticationResult authResult; try { authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } catch (Exception e) { log.error("Failed to get authentication token for key vault.",e); // e.printStackTrace(); } return ""; } }; }
Example #18
Source File: LocateMaleFemaleFaces.java From Azure-Serverless-Computing-Cookbook-Second-Edition with MIT License | 6 votes |
private static ComputerVisionClient getClient() { return new ComputerVisionClientImpl( System.getenv("CognitiveServicesApiEndpoint"), new ServiceClientCredentials() { @Override public void applyCredentialsFilter(Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder(); requestBuilder.addHeader("Ocp-Apim-Subscription-Key", System.getenv("CognitiveServicesApiKey")); request = requestBuilder.build(); return chain.proceed(request); } } ); } } ); }
Example #19
Source File: KeyVaultClientIntegrationTestBase.java From azure-keyvault-java with MIT License | 6 votes |
private static ServiceClientCredentials createTestCredentials() throws Exception { return new KeyVaultCredentials() { @Override public String doAuthenticate(String authorization, String resource, String scope) { try { if (isRecordMode()) { AuthenticationResult authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } else { return ""; } } catch (Exception ex) { throw new RuntimeException(ex); } } }; }
Example #20
Source File: ITManagedStorageAccountKey.java From azure-keyvault-java with MIT License | 6 votes |
private static ServiceClientCredentials createTestCredentials() throws Exception { return new KeyVaultCredentials() { @Override public String doAuthenticate(String authorization, String resource, String scope) { try { if (isRecordMode()) { AuthenticationResult authResult = getAccessToken(authorization, resource); return authResult.getAccessToken(); } else { return ""; } } catch (Exception ex) { throw new RuntimeException(ex); } } }; }
Example #21
Source File: KeyVaultClientIntegrationTestBase.java From azure-keyvault-java with MIT License | 5 votes |
protected RestClient buildPlaybackRestClient(ServiceClientCredentials credentials, String baseUrl) throws IOException { return buildRestClient(new RestClient.Builder().withBaseUrl(baseUrl) .withSerializerAdapter(new AzureJacksonAdapter()) .withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials) .withLogLevel(LogLevel.NONE) .withNetworkInterceptor(new LoggingInterceptor(LogLevel.BODY_AND_HEADERS)) .withNetworkInterceptor(interceptorManager.initInterceptor()) .withInterceptor(new ResourceManagerThrottlingInterceptor())); }
Example #22
Source File: KeyVaultClientCustomImpl.java From azure-keyvault-java with MIT License | 4 votes |
protected KeyVaultClientCustomImpl(ServiceClientCredentials credentials) { super(credentials); }
Example #23
Source File: AzureKeyVaultClientFactory.java From tessera with Apache License 2.0 | 4 votes |
AzureKeyVaultClientFactory(ServiceClientCredentials clientCredentials) { this.clientCredentials = clientCredentials; }
Example #24
Source File: ContainerServiceManagementClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of ContainerServiceManagementClient client. * * @param credentials the management credentials for Azure */ public ContainerServiceManagementClientImpl(ServiceClientCredentials credentials) { this("https://management.azure.com", credentials); }
Example #25
Source File: DnsManagementClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of DnsManagementClient client. * * @param baseUrl the base URL of the host * @param credentials the management credentials for Azure */ public DnsManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { super(baseUrl, credentials); initialize(); }
Example #26
Source File: ContainerServiceManagementClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of ContainerServiceManagementClient client. * * @param baseUrl the base URL of the host * @param credentials the management credentials for Azure */ public ContainerServiceManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { super(baseUrl, credentials); initialize(); }
Example #27
Source File: CdnManagementClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of CdnManagementClient client. * * @param credentials the management credentials for Azure */ public CdnManagementClientImpl(ServiceClientCredentials credentials) { this("https://management.azure.com", credentials); }
Example #28
Source File: CdnManagementClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of CdnManagementClient client. * * @param baseUrl the base URL of the host * @param credentials the management credentials for Azure */ public CdnManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { super(baseUrl, credentials); initialize(); }
Example #29
Source File: DnsManagementClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of DnsManagementClient client. * * @param credentials the management credentials for Azure */ public DnsManagementClientImpl(ServiceClientCredentials credentials) { this("https://management.azure.com", credentials); }
Example #30
Source File: ManagedServiceIdentityClientImpl.java From azure-libraries-for-java with MIT License | 2 votes |
/** * Initializes an instance of ManagedServiceIdentityClient client. * * @param credentials the management credentials for Azure */ public ManagedServiceIdentityClientImpl(ServiceClientCredentials credentials) { this("https://management.azure.com", credentials); }