API અને ટોકન ક્લાયન્ટ માટે Microsoft Graph Java 6 પ્રોક્સી સેટિંગ્સ
ઇનિશિયલાઇઝેશન દરમિયાન Azure Identity નો Netty માર્ગ અને Graph નો મિડલવેર જાળવતો OkHttp માર્ગ વાપરો.
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 નું ડિફોલ્ટ મિડલવેર જાળવે છે; કામગીરી માટે અંતિમ graph ક્લાયન્ટ વાપરો.
પ્રમાણિત મધ્યસ્થીને બંને માર્ગે એકાઉન્ટ સેટઅપ જોઈએ: Azure ProxyOptions.setCredentials અને OkHttp proxyAuthenticator પોતાના સંબંધિત ટ્રાન્સપોર્ટ પૂરા પાડે છે. કેશ કરેલો ટોકન કન્ફિગર ન કરેલો ટોકન માર્ગ છુપાવી શકે છે.
માલિકીના ટ્રાન્સપોર્ટ ઘટક સાથે રાખો અને સાફ કરો. જૂના TokenCredentialAuthProvider બિલ્ડરો બીજી SDK પેઢીને લક્ષ્ય બનાવે છે.