var address = new java.net.InetSocketAddress("proxy.example", 8080);
var tokenProxy = new com.azure.core.http.ProxyOptions(
    com.azure.core.http.ProxyOptions.Type.HTTP, address);
var tokenHttp = new com.azure.core.http.netty.NettyAsyncHttpClientBuilder()
    .proxy(tokenProxy).build();
var credential = new com.azure.identity.ClientSecretCredentialBuilder()
    .tenantId(tenantId).clientId(clientId).clientSecret(clientSecret)
    .httpClient(tokenHttp).build();

String[] scopes = {"https://graph.microsoft.com/.default"};
String[] allowedHosts = {"graph.microsoft.com"};
var auth = new com.microsoft.kiota.authentication.AzureIdentityAuthenticationProvider(
    credential, allowedHosts, scopes);
var graphHttp = com.microsoft.graph.core.requests.GraphClientFactory.create()
    .proxy(new java.net.Proxy(java.net.Proxy.Type.HTTP, address))
    .build();
var graph = new com.microsoft.graph.serviceclient.GraphServiceClient(auth, graphHttp);

இருக்கும் டெனன்ட்/கிளையண்ட் சான்றுகளைப் பயன்படுத்தவும். டோக்கன் மற்றும் Graph இரு எண்ட்பாயிண்ட்களுக்கும் பொது இடைத்தரகர்கள் அனுமதிக்கப்படும் இடத்தில், HTTP ப்ராக்ஸி பட்டியல் பகிரப்பட்ட கணக்கற்ற HTTP ப்ராக்ஸி முகவரிக்கான வேட்பாளர்களை வழங்குகிறது. காட்டப்படும் பொது-கிளவுட் ஸ்கோப்புகளும் அனுமதிக்கப்பட்ட ஹோஸ்டும் நோக்கமிட்ட கிளவுட் வரிசைப்படுத்தலுடன் பொருந்த வேண்டும்.

httpClient(tokenHttp) Azure Identity இன் டோக்கன் பாதையை வழங்குகிறது. GraphClientFactory.create() API ப்ராக்ஸியைச் சேர்க்கும்போது Graph இன் இயல்புநிலை middleware-ஐ தக்கவைக்கிறது; செயல்பாடுகளுக்கு இறுதி graph கிளையண்டைப் பயன்படுத்தவும்.

அங்கீகரிக்கப்பட்ட இடைத்தரகருக்கு இரு பாதைகளிலும் கணக்கு அமைப்பு தேவை: Azure ProxyOptions.setCredentials மற்றும் OkHttp proxyAuthenticator தத்தமது இடமாற்றங்களுக்கு சேவை செய்கின்றன. தற்காலிகச் சேமிப்பில் உள்ள டோக்கன், அமைக்கப்படாத டோக்கன் பாதையை மறைக்கக்கூடும்.

உங்கள் சொந்த இடமாற்றங்களை கூறுடன் சேர்த்து வைத்து சுத்தம் செய்யுங்கள். பழைய TokenCredentialAuthProvider பில்டர்கள் வேறொரு SDK தலைமுறையை இலக்காகக் கொண்டவை.

தொடர்புடைய கட்டுரைகள்