Azure / azure-service-bus-java

☁️ Java client library for Azure Service Bus
https://azure.microsoft.com/services/service-bus
MIT License
60 stars 59 forks source link

use metadata service to grab JWT token #298

Closed sjyang18 closed 6 years ago

sjyang18 commented 6 years ago

Description

This is a patch to fix the issue I reported in (https://github.com/Azure/azure-service-bus-java/issues/297). Reference document is https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token.

This checklist is used to make sure that common guidelines for a pull request are followed.

warrenzhu25 commented 5 years ago

I want to try MSI feature, but I got com.microsoft.azure.servicebus.primitives.ServiceBusException: Error{condition=amqp:connection:framing-error, description='connection aborted', info=null}. I used 1.2.8. Want to confirm which version should I use? Is there some log I can search for to determine whether MSI took effect?

sjyang18 commented 5 years ago

Definitely, 1.2.8 does not include my patch and I verified that. My patch was merged into dev, and eventually in the master branch, but it doesn't seem to be included in the latest release.

https://github.com/Azure/azure-service-bus-java/blob/master/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedServiceIdentityTokenProvider.java

I will contact the team and let them know. Meanwhile, you may checkout and build the master branch locally, and try out. Or, you may checkout my workaround (https://github.com/sjyang18/ServiceBusWithManagedIdentity) with 1.2.8.