Examples of OAuthConfig


Examples of com.google.sitebricks.mail.oauth.OAuthConfig

      channel.write(". CAPABILITY\r\n");
      if (config.getPassword() != null)
        channel.write(". login " + config.getUsername() + " " + config.getPassword() + "\r\n");
      else if (config.getOAuthConfig() != null) {
        // Use xoauth authentication.
        OAuthConfig oauth = config.getOAuthConfig();

        //noinspection ConstantConditions
        String oauthString = new XoauthSasl(config.getUsername(),
            oauth.clientId,
            oauth.clientSecret)
View Full Code Here

Examples of com.google.sitebricks.mail.oauth.OAuthConfig

    OAuthorize oauthorize = oauthorize(clientId, clientSecret);
    System.out.println("Requesting email via OAuth...");


    final MailClient client = mail.clientOf("imap.gmail.com", 993)
        .prepareOAuth("dhanji@gmail.com", new OAuthConfig(
            oauthorize.accessToken,
            oauthorize.code,
            clientId,
            clientSecret));
View Full Code Here

Examples of org.brickred.socialauth.util.OAuthConfig

    domainMap.put(Constants.NIMBLE, "api.nimble.com");
    domainMap.put(Constants.LINKEDINOAUTH2, "api.linkedin.com");

    providersConfig = new HashMap<String, OAuthConfig>();

    OAuthConfig c = new OAuthConfig("openid", "openid");
    c.setProviderImplClass(org.brickred.socialauth.provider.OpenIdImpl.class);
    providersConfig.put(Constants.OPENID, c);

  }
View Full Code Here

Examples of org.brickred.socialauth.util.OAuthConfig

          + ".consumer_secret");
      if (cKey != null && cSecret != null) {
        cKey = cKey.trim();
        cSecret = cSecret.trim();
        LOG.debug("Loading configuration for provider : " + key);
        OAuthConfig conf = new OAuthConfig(cKey, cSecret);
        conf.setId(key);
        conf.setProviderImplClass(providersImplMap.get(key));
        if (applicationProperties.containsKey(value
            + ".custom_permissions")) {
          String perms = applicationProperties.getProperty(
              value + ".custom_permissions").trim();
          if (perms.length() > 0) {
            conf.setCustomPermissions(perms);
          }
        }
        if (applicationProperties.containsKey(value
            + ".request_token_url")) {
          String reqUrl = applicationProperties.getProperty(
              value + ".request_token_url").trim();
          if (reqUrl.length() > 0) {
            conf.setRequestTokenUrl(reqUrl.trim());
          }
        }
        if (applicationProperties.containsKey(value
            + ".authentication_url")) {
          String authUrl = applicationProperties.getProperty(
              value + ".authentication_url").trim();
          if (authUrl.length() > 0) {
            conf.setAuthenticationUrl(authUrl.trim());
          }
        }
        if (applicationProperties.containsKey(value
            + ".access_token_url")) {
          String tokenUrl = applicationProperties.getProperty(
              value + ".access_token_url").trim();
          if (tokenUrl.length() > 0) {
            conf.setAccessTokenUrl(tokenUrl.trim());
          }
        }
        if (applicationProperties.containsKey(value + ".plugins")) {
          String pluginsStr = applicationProperties.getProperty(
              value + ".plugins").trim();
          if (pluginsStr.length() > 0) {
            String plugins[] = pluginsStr.split(",");
            if (plugins.length > 0) {
              List<String> pluginScopes = new ArrayList<String>();
              conf.setRegisteredPlugins(plugins);
              for (String plugin : plugins) {
                if (applicationProperties.containsKey(plugin
                    + ".scope")) {
                  String pscope = applicationProperties
                      .getProperty(plugin + ".scope")
                      .trim();
                  if (pscope.length() > 0) {
                    String sarr[] = pscope.split(",");
                    pluginScopes
                        .addAll(Arrays.asList(sarr));
                  }
                }
              }
              if (!pluginScopes.isEmpty()) {
                conf.setPluginsScopes(pluginScopes);
              }
            }
          }
        }
        providersConfig.put(key, conf);
View Full Code Here

Examples of org.brickred.socialauth.util.OAuthConfig

   * @throws SocialAuthException
   * @throws SocialAuthConfigurationException
   */
  public OAuthConfig getProviderConfig(final String id)
      throws SocialAuthException, SocialAuthConfigurationException {
    OAuthConfig config = providersConfig.get(id);
    if (config == null) {
      try {
        new URL(id);
        config = getProviderConfig(Constants.OPENID);
        if (config != null) {
          config.setId(id);
        }
      } catch (MalformedURLException me) {
        throw new SocialAuthException(id
            + " is not a provider or valid OpenId URL");
      }
    }
    if (config == null) {
      throw new SocialAuthConfigurationException("Configuration of " + id
          + " provider is not found");
    }

    if (config.get_consumerSecret().length() <= 0) {
      throw new SocialAuthConfigurationException(id
          + " consumer_secret value is null");
    }
    if (config.get_consumerKey().length() <= 0) {
      throw new SocialAuthConfigurationException(id
          + " consumer_key value is null");
    }
    return config;
  }
View Full Code Here

Examples of org.brickred.socialauth.util.OAuthConfig

    return providersMap.get(providerId);
  }

  private AuthProvider getProviderInstance(final String id)
      throws SocialAuthConfigurationException, SocialAuthException {
    OAuthConfig config = socialAuthConfig.getProviderConfig(id);
    Class<?> obj = config.getProviderImplClass();
    AuthProvider provider;
    try {
      Constructor<?> cons = obj.getConstructor(OAuthConfig.class);
      provider = (AuthProvider) cons.newInstance(config);
    } catch (NoSuchMethodException me) {
View Full Code Here

Examples of org.brickred.socialauth.util.OAuthConfig

  private static AuthProvider loadProvider(final String id,
      final Properties props) throws Exception {
    Class<?> obj = providerMap.get(id);
    props.setProperty("id", id);
    AuthProvider provider;
    OAuthConfig conf;

    if (obj == null) {
      try {
        new URL(id); // just validating, don't need the value
        obj = providerMap.get("openid");
        conf = new OAuthConfig(null, null);
        conf.setId(id);
      } catch (MalformedURLException me) {
        throw new SocialAuthException(id
            + " is not a provider or valid OpenId URL");
      }
    } else {
      String key;
      if (domainMap.containsKey(id)) {
        key = domainMap.get(id);
      } else {
        key = id;
      }
      String consumerKey = props.getProperty(key + ".consumer_key");
      if (consumerKey == null) {
        throw new IllegalStateException(key
            + ".consumer_key not found.");
      }

      String consumerSecret = props.getProperty(key + ".consumer_secret");
      if (consumerSecret == null) {
        throw new IllegalStateException(key
            + ".consumer_secret not found.");
      }
      conf = new OAuthConfig(consumerKey, consumerSecret);
      conf.setId(id);
    }

    try {
      Constructor<?> cons = obj.getConstructor(OAuthConfig.class);
      provider = (AuthProvider) cons.newInstance(conf);
View Full Code Here

Examples of org.jinstagram.auth.model.OAuthConfig

    Preconditions.checkEmptyString(apiKey, "You must provide an api key");
    Preconditions.checkEmptyString(apiSecret,
        "You must provide an api secret");

    return api.createService(new OAuthConfig(apiKey, apiSecret, callback,
        scope, display));
  }
View Full Code Here

Examples of org.scribe.model.OAuthConfig

   
    @Override
    protected void internalInit() {
        super.internalInit();
        CommonHelper.assertNotBlank("scope", this.scope);
        this.service = new PayPalOAuth20ServiceImpl(new PayPalApi20(), new OAuthConfig(this.key, this.secret,
                                                                                       this.callbackUrl,
                                                                                       SignatureType.Header,
                                                                                       this.scope, null),
                                                    this.connectTimeout, this.readTimeout, this.proxyHost,
                                                    this.proxyPort);
View Full Code Here

Examples of org.scribe.model.OAuthConfig

   
    @Override
    protected void internalInit() {
        super.internalInit();
        this.service = new ProxyOAuth10aServiceImpl(new LinkedInApi(),
                                                    new OAuthConfig(this.key, this.secret, this.callbackUrl,
                                                                    SignatureType.Header, null, null),
                                                    this.connectTimeout, this.readTimeout, this.proxyHost,
                                                    this.proxyPort);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.