Beispiel #1
0
 @Override
 public void setPermission(final Permission p) {
   LOG.debug("Permission requested : " + p.toString());
   this.scope = p;
   authenticationStrategy.setPermission(this.scope);
   authenticationStrategy.setScope(getScope());
 }
Beispiel #2
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());
  }