Creating GraphServiceClient using version 6

41 Views Asked by At

I am new to Graph API and I am trying to copy files to share point using Java and Graph API. I create the GraphServiceClient as below. I am using latest Graph API version 6.

final ClientCertificateCredential certificateCredential = new ClientCertificateCredentialBuilder().clientId(clientId).tenantId(tenantId).pfxCertificate(certPath).clientCertificatePassword(certPassword).httpClient(httpClient).build();

final AzureIdentityAuthenticationProvider authProvider = new AzureIdentityAuthenticationProvider(certificateCredential, null, SCOPE);
return new GraphServiceClient(authProvider, okHttpClient);

Is this the correct way of creating the graphServiceClient? Here I used httpClient as well okHttpClient. This does not feel right to use both to me but I am not sure. Also This method of giving certificate password is shown as vulnerable in Checkmarx. Is there a better/safe way to use it? There is one more method with pemCertificate but that expects the certificate with key together in the same file.

0

There are 0 best solutions below