microsoft-authentication-library-for-java
microsoft-authentication-library-for-java copied to clipboard
Make getManagedIdentitySource static
Adjusts ManagedIdentityApplication to make the getManagedIdentitySource method static. This is to solve a niche issue when testing an application that uses Managed Identity, where a developer would want to test an app with multiple mocked MI sources on one machine.
Although this looks like it is adjusting public APIs, the actual change in the built package is minor and there should be no breaking change:
- Previously, the Lombok
@Getterannotation was creating a public method calledgetManagedIdentitySourcein the final package - The changes in this PR create an explicit
getManagedIdentitySourcemethod that is also public, and removes the annotation for Lombok to create that same method - Putting those two points together, this should be no different from just changing the internals of the method to return the result of
ManagedIdentityClient.getManagedIdentitySource()rather than the current value of themanagedIdentitySourcefield - Because of all that, the values returned should be the same and the API should look no different in the actual package that gets built
Additionally, static methods can be access through an instance of a class just like a non-static method, so making this method static will at worst cause a minor warning in an IDE about using a static method improperly. The RevAPI plugin was used to ensure that this was the only part of the API that could be considered 'changed' when compared to the last released msal4j package.