/** * 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 * @param handler the instantiated Oauth2 provider instance handler */ static void discover(final Vertx vertx, final OAuth2ClientOptions config, final Handler<AsyncResult<OAuth2Auth>> handler) { // don't override if already set final String site = config.getSite() == null ? "https://accounts.google.com" : config.getSite(); OpenIDConnectAuth.discover( vertx, new OAuth2ClientOptions(config) .setSite(site) .setUserInfoParameters(new JsonObject() .put("alt", "json")) .setScopeSeparator(" "), handler); }
case "scopeSeparator": if (member.getValue() instanceof String) { obj.setScopeSeparator((String)member.getValue());
/** * 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 * @param handler the instantiated Oauth2 provider instance handler */ static void discover(final Vertx vertx, final OAuth2ClientOptions config, final Handler<AsyncResult<OAuth2Auth>> handler) { // don't override if already set final String site = config.getSite() == null ? "https://login.salesforce.com" : config.getSite(); OpenIDConnectAuth.discover(vertx, new OAuth2ClientOptions(config) .setSite("https://login.salesforce.com") .setScopeSeparator("+"), handler); } }
/** * 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 Github * * @param clientId the client id given to you by Github * @param clientSecret the client secret given to you by Github * @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("https://github.com/login") .setTokenPath("/oauth/access_token") .setAuthorizationPath("/oauth/authorize") .setUserInfoPath("https://api.github.com/user") .setScopeSeparator(" ") .setClientID(clientId) .setClientSecret(clientSecret) .setHeaders(new JsonObject() .put("User-Agent", "vertx-auth-oauth2"))); } }
/** * 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 * @param handler the instantiated Oauth2 provider instance handler */ static void discover(final Vertx vertx, final OAuth2ClientOptions config, final Handler<AsyncResult<OAuth2Auth>> handler) { // don't override if already set final String site = config.getSite() == null ? "https://login.windows.net/common" : config.getSite(); OpenIDConnectAuth.discover( vertx, new OAuth2ClientOptions(config) // Azure OpenId does not return the same url where the request was sent to .setValidateIssuer(false) .setSite(site) .setScopeSeparator(","), handler); } }
/** * 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 Google * * @param clientId the client id given to you by Google * @param clientSecret the client secret given to you by Google * @param httpClientOptions custom http client options */ static OAuth2Auth create(Vertx vertx, String clientId, String clientSecret, HttpClientOptions httpClientOptions) { return OAuth2Auth.create(vertx, new OAuth2ClientOptions(httpClientOptions) .setSite("https://accounts.google.com") .setFlow(OAuth2FlowType.AUTH_CODE) .setTokenPath("https://www.googleapis.com/oauth2/v3/token") .setAuthorizationPath("/o/oauth2/auth") .setIntrospectionPath("https://www.googleapis.com/oauth2/v3/tokeninfo") .setUserInfoPath("https://www.googleapis.com/oauth2/v3/userinfo") .setJwkPath("https://www.googleapis.com/oauth2/v3/certs") .setUserInfoParameters(new JsonObject() .put("alt", "json")) .setScopeSeparator(" ") .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 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 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 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 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)); } }
/** * 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)); } }