예제 #1
0
 @Override
 public String getAuthorizationUrl(OAuthConfig config) {
   if (config.hasScope()) {
     return String.format(
         SCOPED_AUTHORIZE_URL,
         config.getApiKey(),
         OAuthEncoder.encode(config.getCallback()),
         OAuthEncoder.encode(config.getScope()));
   } else {
     return String.format(
         AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
   }
 }
예제 #2
0
  @Override
  public String getAuthorizationUrl(OAuthConfig config) {
    Preconditions.checkValidUrl(
        config.getCallback(), "Must provide a valid url which will get the code ");

    // Append scope if present
    if (config.hasScope()) {
      return String.format(
          SCOPED_AUTHORIZE_URL,
          config.getApiKey(),
          OAuthEncoder.encode(config.getCallback()),
          OAuthEncoder.encode(config.getScope()));
    } else {
      return String.format(
          AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
    }
  }
예제 #3
0
 public String getAuthorizationUrl(OAuthConfig paramOAuthConfig) {
   Preconditions.checkValidUrl(
       paramOAuthConfig.getCallback(),
       "Must provide a valid url as callback. Facebook does not support OOB");
   if (paramOAuthConfig.hasScope()) {
     Object[] arrayOfObject2 = new Object[3];
     arrayOfObject2[0] = paramOAuthConfig.getApiKey();
     arrayOfObject2[1] = OAuthEncoder.encode(paramOAuthConfig.getCallback());
     arrayOfObject2[2] = OAuthEncoder.encode(paramOAuthConfig.getScope());
     return String.format(
         "https://www.facebook.com/dialog/oauth?client_id=%s&redirect_uri=%s&scope=%s",
         arrayOfObject2);
   }
   Object[] arrayOfObject1 = new Object[2];
   arrayOfObject1[0] = paramOAuthConfig.getApiKey();
   arrayOfObject1[1] = OAuthEncoder.encode(paramOAuthConfig.getCallback());
   return String.format(
       "https://www.facebook.com/dialog/oauth?client_id=%s&redirect_uri=%s", arrayOfObject1);
 }
 /** {@inheritDoc} */
 @Override
 public String getAuthorizationUrl(OAuthConfig config) {
   Preconditions.checkValidUrl(
       config.getCallback(),
       "Must provide a valid url as callback. LinkedIn does not support Out Of Band Auth.");
   // Append scope if present
   if (config.hasScope()) {
     return String.format(
         SCOPED_AUTHORIZE_URL,
         config.getApiKey(),
         OAuthEncoder.encode(state),
         OAuthEncoder.encode(config.getCallback()),
         OAuthEncoder.encode(config.getScope()));
   } else {
     return String.format(
         AUTHORIZE_URL,
         config.getApiKey(),
         OAuthEncoder.encode(state),
         OAuthEncoder.encode(config.getCallback()));
   }
 }
예제 #5
0
 public void setProviders(List<OAuthProvider> providers) {
   this.providers = providers;
   // for all providers
   for (OAuthProvider provider : providers) {
     BaseOAuthProvider baseProvider = (BaseOAuthProvider) provider;
     // calculate new callback url by adding the OAuth provider name
     baseProvider.setCallbackUrl(
         baseProvider.getCallbackUrl()
             + "?"
             + OAUTH_PROVIDER
             + "="
             + OAuthEncoder.encode(provider.getType()));
     // and init the provider
     provider.init();
   }
 }
 @Override
 public String getAuthorizationUrl(OAuthConfig config) {
   return String.format(
       AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
 }