microsoft / oauth2-useragent

Microsoft OAuth 2.0 User Agent library for Java. Provides classes to facilitate the implementation of "4.1. Authorization Code Grant" from RFC 6749.
Other
35 stars 22 forks source link

Add a package locator to find the location of our class #14

Closed yacaovsnc closed 8 years ago

yacaovsnc commented 8 years ago

This pull request attempts to fix issue #9.

Description:

When trying to utilize this oauth2-useragent library in our VSTS-IntelliJ plugin, we have realized the we weren't able to locate and launch any providers because the oauth2-useragent jar file is not on classpath -- IntelliJ uses plugin classloaders.

This results in no browser windows are coming up, and authentication just fails.

Solution

This pull request attempt to locate the oauth2-useragent jar from two different approaches:

  1. From ProtectionDomain of the UserAgentImpl class, get its CodeSource location.
  2. Get the UserAgentImpl resource from its classloader, and try to parse the jar or folder that contains the package.

    Manual testing

  3. Manually replace the oauth2-useragent jar inside the IntelliJ plugin zip file.
  4. Install the new modified plugin.
  5. Set a JVM option -DuseJavaFxAuthLibrary=true, and start IntelliJ
  6. Verify the browser windows comes up when clicked on "Sign in" from checkout or import dialog.
msftclas commented 8 years ago

Hi @yacaovsnc, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

It looks like you're a Microsoft contributor (Yang Cao (VSNC)). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

olivierdagenais commented 8 years ago

Thank you for your contribution and your help!