use of com.google.api.client.auth.oauth.OAuthRsaSigner in project che by eclipse.
the class OAuthAuthenticator method getOAuthRsaSigner.
private OAuthRsaSigner getOAuthRsaSigner() throws NoSuchAlgorithmException, InvalidKeySpecException {
OAuthRsaSigner oAuthRsaSigner = new OAuthRsaSigner();
oAuthRsaSigner.privateKey = getPrivateKey(privateKey);
return oAuthRsaSigner;
}
use of com.google.api.client.auth.oauth.OAuthRsaSigner in project syndesis-qe by syndesisio.
the class OAuthJiraAuthenticationHandler method createAccessToken.
private AbstractOAuthGetToken createAccessToken() throws NoSuchAlgorithmException, InvalidKeySpecException {
Account jiraAccount = AccountsDirectory.getInstance().get("Jira");
String privateKey = jiraAccount.getProperty("privatekey");
String tempToken = jiraAccount.getProperty("accesstoken");
String verifier = jiraAccount.getProperty("verificationcode");
String consumerKey = jiraAccount.getProperty("consumerkey");
String jiraUrl = jiraAccount.getProperty("jiraurl");
byte[] privateBytes = Base64.decodeBase64(privateKey);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateBytes);
KeyFactory kf = KeyFactory.getInstance("RSA");
OAuthRsaSigner oAuthRsaSigner = new OAuthRsaSigner();
oAuthRsaSigner.privateKey = kf.generatePrivate(keySpec);
JiraOAuthGetAccessToken accessToken = new JiraOAuthGetAccessToken(jiraUrl + "/plugins/servlet/oauth/access-token");
accessToken.temporaryToken = tempToken;
accessToken.signer = oAuthRsaSigner;
accessToken.transport = new ApacheHttpTransport();
accessToken.verifier = verifier;
accessToken.consumerKey = consumerKey;
return accessToken;
}
Aggregations