Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author <a href="mailto:[email protected]">Paulo Lopes</a>
*/
@VertxGen
public interface LinkedInAuth {
public interface LinkedInAuth extends OpenIDConnectAuth {

/**
* Create a OAuth2Auth provider for LinkedIn
Expand All @@ -52,9 +52,31 @@ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, Http
.setHttpClientOptions(httpClientOptions)
.setClientId(clientId)
.setClientSecret(clientSecret)
.setSite("https://www.linkedin.com")
.setTokenPath("/oauth/v2/accessToken")
.setAuthorizationPath("/oauth/v2/authorization")
.setUserInfoPath("/people/~"));
.setSite("https://www.linkedin.com/oauth")
.setTokenPath("/v2/accessToken")
.setAuthorizationPath("/v2/authorization")
.setUserInfoPath("/v2/userinfo"));
}

/**
* Create a OAuth2Auth provider for OpenID Connect Discovery. The discovery will use the default site in the
* configuration options and attempt to load the well known descriptor. If a site is provided (for example when
* running on a custom instance) that site will be used to do the lookup.
* <p>
* If the discovered config includes a json web key url, it will be also fetched and the JWKs will be loaded
* into the OAuth provider so tokens can be decoded.
*
* @param vertx the vertx instance
* @param config the initial config
* @return future with the instantiated Oauth2 provider instance handler
* @see SalesforceAuth#discover(Vertx, OAuth2Options, Handler)
*/
static Future<OAuth2Auth> discover(final Vertx vertx, final OAuth2Options config) {
// don't override if already set
final String site = config.getSite() == null ? "https://www.linkedin.com/oauth" : config.getSite();

return OpenIDConnectAuth.discover(vertx,
new OAuth2Options(config)
.setSite(site));
}
}
Loading