code: public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String userName, String password) throws MalformedURLException
      {
          AuthenticationContext authContext = createAuthenticationContext(authorityUrl);
          return new AzureActiveDirectoryTokenProvider(authContext, clientId, userName, password);
      }
docs: Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId, username and password.
  This is a utility method.
  @param authorityUrl URL of the Azure Active Directory instance
  @param clientId client id of the application
  @param userName user name
  @param password password
  @return an instance of Azure Active Directory token provider
  @throws MalformedURLException if the authority URL is not well formed