Search in sources :

Example 1 with OAuthClientCredentials

use of io.pivotal.cla.config.OAuthClientCredentials in project pivotal-cla by pivotalsoftware.

the class MylynGitHubApi method getToken.

private String getToken(AccessTokenRequest request) {
    OAuthAccessTokenParams oauthParams = request.getOauthParams();
    Map<String, String> params = new HashMap<String, String>();
    OAuthClientCredentials credentials = request.getCredentials();
    params.put("client_id", credentials.getClientId());
    params.put("client_secret", credentials.getClientSecret());
    params.put("code", oauthParams.getCode());
    params.put("state", oauthParams.getState());
    params.put("redirect_url", oauthParams.getCallbackUrl());
    ResponseEntity<AccessTokenResponse> token = rest.postForEntity(this.authorizeUrl, params, AccessTokenResponse.class);
    return token.getBody().getAccessToken();
}
Also used : OAuthClientCredentials(io.pivotal.cla.config.OAuthClientCredentials)

Example 2 with OAuthClientCredentials

use of io.pivotal.cla.config.OAuthClientCredentials in project pivotal-cla by pivotalsoftware.

the class MylynGitHubApiITests method setup.

@Before
public void setup() throws IOException {
    OAuthClientCredentials credentials = new OAuthClientCredentials();
    credentials.setClientId("client-id");
    credentials.setClientSecret("client-secret");
    oauthConfig = new ClaOAuthConfig();
    oauthConfig.setMain(credentials);
    oauthConfig.setScheme("http");
    oauthConfig.setGitHubHost(server.getServer().getHostName());
    oauthConfig.setGitHubApiHost(server.getServer().getHostName());
    oauthConfig.setPort(server.getServer().getPort());
    oauthConfig.setPivotalClaAccessToken("pivotal-cla-accessToken");
    service = new MylynGitHubApi(oauthConfig);
}
Also used : ClaOAuthConfig(io.pivotal.cla.config.ClaOAuthConfig) OAuthClientCredentials(io.pivotal.cla.config.OAuthClientCredentials) Before(org.junit.Before)

Aggregations

OAuthClientCredentials (io.pivotal.cla.config.OAuthClientCredentials)2 ClaOAuthConfig (io.pivotal.cla.config.ClaOAuthConfig)1 Before (org.junit.Before)1