use of org.wso2.carbon.apimgt.rest.integration.tests.store.auth.OAuth in project carbon-apimgt by wso2.
the class APIUtil method isMapExistingAuthAppsEnabled.
/**
* Used to check whether Provisioning Out-of-Band OAuth Clients feature is enabled
*
* @return true if feature is enabled
*/
public static boolean isMapExistingAuthAppsEnabled() {
APIManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration();
String mappingEnabled = config.getFirstProperty(APIConstants.API_STORE_MAP_EXISTING_AUTH_APPS);
if (mappingEnabled == null) {
return false;
}
return Boolean.parseBoolean(mappingEnabled);
}
use of org.wso2.carbon.apimgt.rest.integration.tests.store.auth.OAuth 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