.setClientSecret("client-secret") .setSite("http://localhost:10000"));
.setClientSecret("client-secret") .setSite("http://localhost:10000"));
.setClientSecret("client-secret") .setSite("http://localhost:10000"));
/** * Create a OAuth2Auth provider for Microsoft Azure Active Directory * * @param clientId the client id given to you by Azure * @param clientSecret the client secret given to you by Azure * @param guid the guid of your application given to you by Azure * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, String guid, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, new OAuth2ClientOptions(httpClientOptions) .setFlow(OAuth2FlowType.AUTH_CODE) .setSite("https://login.windows.net/" + guid) .setTokenPath("/oauth2/token") .setAuthorizationPath("/oauth2/authorize") .setScopeSeparator(",") .setClientID(clientId) .setClientSecret(clientSecret) .setExtraParameters( new JsonObject().put("resource", guid))); }
/** * Create a OAuth2Auth provider for Foursquare * * @param clientId the client id given to you by Foursquare * @param clientSecret the client secret given to you by Foursquare * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://foursquare.com") .setTokenPath("/oauth2/access_token") .setAuthorizationPath("/oauth2/authenticate") .setUserInfoPath("/users/self") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for SoundCloud * * @param clientId the client id given to you by SoundCloud * @param clientSecret the client secret given to you by SoundCloud * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://api.soundcloud.com") .setTokenPath("/oauth2/token") .setAuthorizationPath("/connect") .setUserInfoPath("/me.json") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for live.com * * @param clientId the client id given to you by live.com * @param clientSecret the client secret given to you by live.com * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://login.live.com") .setTokenPath("/oauth20_token.srf") .setAuthorizationPath("/oauth20_authorize.srf") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Heroku * * @param clientId the client id given to you by Heroku * @param clientSecret the client secret given to you by Heroku * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://id.heroku.com") .setTokenPath("/oauth/token") .setAuthorizationPath("/oauth/authorize") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Mailchimp * * @param clientId the client id given to you by Mailchimp * @param clientSecret the client secret given to you by Mailchimp * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://login.mailchimp.com") .setTokenPath("/oauth2/token") .setAuthorizationPath("/oauth2/authorize") .setUserInfoPath("/oauth2/metadata") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Twitter * * @param clientId the client id given to you by Twitter * @param clientSecret the client secret given to you by Twitter * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://api.twitter.com") .setTokenPath("/oauth/access_token") .setAuthorizationPath("/oauth/authorize") .setUserInfoPath("/1.1/users/show.json") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for CloudFoundry UAA * * @param clientId the client id given to you by CloudFoundry UAA * @param clientSecret the client secret given to you by CloudFoundry UAA * @param uuaURL the url to your UUA server instance * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, String uuaURL, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite(uuaURL) .setTokenPath("/oauth/token") .setAuthorizationPath("/oauth/authorize") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Salesforce * * @param clientId the client id given to you by Salesforce * @param clientSecret the client secret given to you by Salesforce * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, new OAuth2ClientOptions(httpClientOptions) .setFlow(OAuth2FlowType.AUTH_CODE) .setSite("http://login.salesforce.com") .setTokenPath("/services/oauth2/token") .setAuthorizationPath("/services/oauth2/authorize") .setScopeSeparator("+") .setClientID(clientId) .setClientSecret(clientSecret)); }
/** * Create a OAuth2Auth provider for Stripe * * @param clientId the client id given to you by Stripe * @param clientSecret the client secret given to you by Stripe * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://connect.stripe.com") .setTokenPath("/oauth2/token") .setAuthorizationPath("/oauth2/authorize") .setUserInfoPath("/v1/account") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for App.net * * @param clientId the client id given to you by box.com * @param clientSecret the client secret given to you by box.com * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://account.box.com") .setTokenPath("/api/oauth2/token") .setAuthorizationPath("/api/oauth2/authorize") .setUserInfoPath("/users/me") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Facebook * * @param clientId the client id given to you by Facebook * @param clientSecret the client secret given to you by Facebook * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://www.facebook.com") .setTokenPath("https://graph.facebook.com/oauth/access_token") .setAuthorizationPath("/dialog/oauth") .setUserInfoPath("https://graph.facebook.com/me") .setScopeSeparator(",") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for LinkedIn * * @param clientId the client id given to you by LinkedIn * @param clientSecret the client secret given to you by LinkedIn * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://www.linkedin.com") .setTokenPath("/uas/oauth2/accessToken") .setAuthorizationPath("/uas/oauth2/authorization") .setUserInfoPath("/people/~") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Dropbox * * @param clientId the client id given to you by Dropbox * @param clientSecret the client secret given to you by Dropbox * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://www.dropbox.com") .setTokenPath("/oauth2/token") .setAuthorizationPath("/oauth2/authorize") .setRevocationPath("/oauth2/token/revoke") .setUserInfoPath("/account/info") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Instagram * * @param clientId the client id given to you by Instagram * @param clientSecret the client secret given to you by Instagram * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://api.instagram.com") .setTokenPath("/oauth/access_token") .setAuthorizationPath("/oauth/authorize") .setUserInfoPath("/v1/users/self") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret)); } }
/** * Create a OAuth2Auth provider for Shopify * * @param clientId the client id given to you by Shopify * @param clientSecret the client secret given to you by Shopify * @param shop your shop name * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, String shop, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions(httpClientOptions) .setSite("https://" + shop + ".myshopify.com") .setTokenPath("/admin/oauth/access_token") .setAuthorizationPath("/admin/oauth/authorize") .setUserInfoPath("/admin/shop.json") .setScopeSeparator(",") .setClientID(clientId) .setClientSecret(clientSecret)); } }
@Test public void unknownHost() { OAuth2Auth auth = OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new OAuth2ClientOptions() .setClientID("client-id") .setClientSecret("client-secret") .setSite("http://zlouklfoux.net.com.info.pimpo.molo")); auth.authenticate(tokenConfig, res -> { if (res.failed()) { assertThat(res.cause(), instanceOf(UnknownHostException.class)); testComplete(); } else { fail("Should have failed"); } }); await(); } }