Пример #1
0
 @Override
 protected List<String> getPluginsList() {
   List<String> list = new ArrayList<String>();
   if (config.getRegisteredPlugins() != null && config.getRegisteredPlugins().length > 0) {
     list.addAll(Arrays.asList(config.getRegisteredPlugins()));
   }
   return list;
 }
Пример #2
0
 private String getScope() {
   StringBuffer result = new StringBuffer();
   String arr[] = null;
   if (Permission.AUTHENTICATE_ONLY.equals(scope)) {
     arr = AuthPerms;
   } else if (Permission.CUSTOM.equals(scope) && config.getCustomPermissions() != null) {
     arr = config.getCustomPermissions().split(",");
   } else {
     arr = AllPerms;
   }
   result.append(arr[0]);
   for (int i = 1; i < arr.length; i++) {
     result.append(",").append(arr[i]);
   }
   String pluginScopes = getPluginsScope(config);
   if (pluginScopes != null) {
     result.append(",").append(pluginScopes);
   }
   return result.toString();
 }
Пример #3
0
  /**
   * Stores configuration for the provider
   *
   * @param providerConfig It contains the configuration of application like consumer key and
   *     consumer secret
   * @throws Exception
   */
  public GitHubImpl(final OAuthConfig providerConfig) throws Exception {
    config = providerConfig;
    if (config.getCustomPermissions() != null) {
      scope = Permission.CUSTOM;
    }

    if (config.getAuthenticationUrl() != null) {
      ENDPOINTS.put(Constants.OAUTH_AUTHORIZATION_URL, config.getAuthenticationUrl());
    } else {
      config.setAuthenticationUrl(ENDPOINTS.get(Constants.OAUTH_AUTHORIZATION_URL));
    }

    if (config.getAccessTokenUrl() != null) {
      ENDPOINTS.put(Constants.OAUTH_ACCESS_TOKEN_URL, config.getAccessTokenUrl());
    } else {
      config.setAccessTokenUrl(ENDPOINTS.get(Constants.OAUTH_ACCESS_TOKEN_URL));
    }

    authenticationStrategy = new OAuth2(config, ENDPOINTS);
    authenticationStrategy.setPermission(scope);
    authenticationStrategy.setScope(getScope());
  }
Пример #4
0
 @Override
 public String getProviderId() {
   return config.getId();
 }