use of org.apache.airavata.security.AiravataSecurityException in project airavata by apache.
the class OAuthAppRegisteringClient method registerApplication.
public OAuthConsumerAppDTO registerApplication(String appName, String consumerId, String consumerSecret) throws AiravataSecurityException {
try {
OAuthConsumerAppDTO consumerAppDTO = new OAuthConsumerAppDTO();
consumerAppDTO.setApplicationName(appName);
// consumer key and secret is set by the application.
consumerAppDTO.setOauthConsumerKey(consumerId);
consumerAppDTO.setOauthConsumerSecret(consumerSecret);
// consumerAppDTO.setUsername(adminUserName);
// initialize trust store for SSL handshake
TrustStoreManager trustStoreManager = new TrustStoreManager();
trustStoreManager.initializeTrustStoreManager(Properties.TRUST_STORE_PATH, Properties.TRUST_STORE_PASSWORD);
stub.registerOAuthApplicationData(consumerAppDTO);
// After registration application is retrieve
return stub.getOAuthApplicationDataByAppName(appName);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
throw new AiravataSecurityException("Error in registering the OAuth application.");
} catch (RemoteException e) {
e.printStackTrace();
throw new AiravataSecurityException("Error in registering the OAuth application.");
} catch (OAuthAdminServiceException e) {
e.printStackTrace();
throw new AiravataSecurityException("Error in registering the OAuth application.");
}
}
Aggregations