コード例 #1
0
ファイル: GitHubImpl.java プロジェクト: jolivares/socialauth
  /**
   * 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());
  }