private Consumer getConsumer(final String consumerKey) { return consumerService.getConsumerByKey(consumerKey) == null ? consumerService.getConsumer() : consumerService.getConsumerByKey(consumerKey); }
Consumer genericOutGoingConsumer = consumerService.getConsumerByKey(consumerKey); if (genericOutGoingConsumer != null) {
private void registerOAuthServiceProvider(final String id, final ApplicationLink applicationLink) { final Consumer consumer = consumerService.getConsumerByKey(id); final String requestTokenUrl = applicationLink.getRpcUrl() + "/request/token"; final String accessTokenUrl = applicationLink.getRpcUrl() + "/access/token"; final String authorizeUrl = applicationLink.getDisplayUrl() + "/authorize/token"; authenticationConfigurationManager.registerProvider( applicationLink.getId(), OAuthAuthenticationProvider.class, ImmutableMap.of(AddServiceProviderManuallyServlet.CONSUMER_KEY_OUTBOUND, consumer.getKey(), AddServiceProviderManuallyServlet.SERVICE_PROVIDER_REQUEST_TOKEN_URL, requestTokenUrl, AddServiceProviderManuallyServlet.SERVICE_PROVIDER_ACCESS_TOKEN_URL, accessTokenUrl, AddServiceProviderManuallyServlet.SERVICE_PROVIDER_AUTHORIZE_URL, authorizeUrl)); log.debug("Associated OAuth ServiceProvider with consumer key '" + consumer.getKey() + "' with Application Link id='" + applicationLink.getId() + "' and name='" + applicationLink.getName() + "'"); }
if (config != null && config.containsKey(CONSUMER_KEY_OUTBOUND)) { final String consumerKey = config.get(CONSUMER_KEY_OUTBOUND); final Consumer consumer = consumerService.getConsumerByKey(consumerKey); final String requestTokenUrl = config.get(SERVICE_PROVIDER_REQUEST_TOKEN_URL); final String accessTokenUrl = config.get(SERVICE_PROVIDER_ACCESS_TOKEN_URL);
final Consumer existingConsumerDuplicatedKey = consumerService.getConsumerByKey(consumerKey); if (existingConsumerDuplicatedServiceName != null) { fieldErrorMessages.put(NAME_PARAMETER, messageFactory.newI18nMessage("auth.oauth.config.consumer.serviceprovider.service.name.exists", existingConsumerDuplicatedServiceName.getKey()));