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();
}
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);
}
Aggregations