/** * Sets the string value to the link. * * @param link the applink to store the value * @param value a string value. May be null. */ protected void setValue(ApplicationLink link, String value) { link.putProperty(key, value); }
@GET @Path("setApplicationLink") public Response setApplicationLinkProperty(@QueryParam("propertyKey") String propertyKey, @QueryParam("propertyValue") String propertyValue) { final ApplicationLink applicationLink = applicationLinkService.getPrimaryApplicationLink(GenericApplicationType.class); applicationLink.putProperty(propertyKey, propertyValue); return ok("Properties updated!").build(); }
protected void setValue(ApplicationLink link, K projectKey, String value) { link.putProperty(makeKey(projectKey), value); }
@PUT @Path("{applinkId}/property/{key}") public Response setProperty(@PathParam("applinkId") String applinkId, @PathParam("key") String key, RestProperty restProperty) throws TypeNotInstalledException { ApplicationId id = parseApplicationId(applinkId); ApplicationLink applink = linkService.getApplicationLink(id); applink.putProperty(key, restProperty.getValue()); return Response.created(URI.create("")).entity(restProperty).build(); }
public void addConsumer(final Consumer consumer, final ApplicationLink applicationLink) { // don't check whether the consumer exists already - transparently upgrade existing OAuth consumers to UAL serviceProviderConsumerStore.put(consumer); applicationLink.putProperty(PROPERTY_INCOMING_CONSUMER_KEY, consumer.getKey()); }
public void updateInboundTrust(final ApplicationLink appLink, final RequestConditions requestConditions) throws ConfigurationException { final Application application = getApplicationCertificate(appLink); trustedAppsManager.addTrustedApplication(application, requestConditions); appLink.putProperty(AbstractTrustedAppsServlet.TRUSTED_APPS_INCOMING_ID, application.getID()); }
public void updateInboundTrust(final ApplicationLink appLink, final RequestConditions requestConditions) throws ConfigurationException { final Application application = getApplicationCertificate(appLink); trustedAppsManager.addTrustedApplication(application, requestConditions); appLink.putProperty(TRUSTED_APPS_INCOMING_ID, application.getID()); }
@Override public void createAppLink(final ConnectAddonBean addon, final String baseUrl, final AuthenticationType authType, final String publicKey, final String addonUserKey) { transactionTemplate.execute((TransactionCallback<Void>) () -> { String pluginKey = addon.getKey(); URI baseUri = URI.create(baseUrl); final ApplicationId expectedApplicationId = ApplicationIdUtil.generate(baseUri); final RemotePluginContainerApplicationType applicationType = typeAccessor.getApplicationType(RemotePluginContainerApplicationType.class); deleteOldAppLinks(pluginKey, expectedApplicationId); final ApplicationLinkDetails details = ApplicationLinkDetails.builder() .displayUrl(baseUri) .isPrimary(false) .name(addon.getName() != null ? addon.getName() : addon.getKey()) .rpcUrl(baseUri) .build(); log.info("Creating an application link for Connect add-on with key '{}'", pluginKey); ApplicationLink link = applicationLinkService.addApplicationLink(expectedApplicationId, applicationType, details); link.putProperty(PLUGIN_KEY_PROPERTY, pluginKey); link.putProperty(JwtConstants.AppLinks.ADD_ON_USER_KEY_PROPERTY_NAME, addonUserKey); link.putProperty("IS_ACTIVITY_ITEM_PROVIDER", Boolean.FALSE.toString()); link.putProperty("system", Boolean.TRUE.toString()); link.putProperty(JwtConstants.AppLinks.AUTH_METHOD_PROPERTY_NAME, authType.toString()); if (authType == AuthenticationType.JWT) { link.putProperty(JwtConstants.AppLinks.SHARED_SECRET_PROPERTY_NAME, publicKey); } return null; }); }
private <T> void putPropertyInto(ApplicationLink applicationLink, com.atlassian.jirafisheyeplugin.upgrade.legacy.domain.fisheye.FishEyeInstance fishEyeInstance, MigrationInstanceProperty<T> property) { final T value = property.getProperty(fishEyeProperties, fishEyeInstance); //if the applicationlink already contains a value for the given property key, then don't overwrite it with the old value //this is so that migration of properties can be executed multiple times, with no ill effects. if (applicationLink.getProperty(property.getMigratedKey()) == null) { log.info(String.format("migrating fisheye property [%s] with value [%s] from instance [%s] to applicationlink [%s] with new key [%s]", property.getKey(), value, fishEyeInstance, applicationLink, property.getMigratedKey())); applicationLink.putProperty(property.getMigratedKey(), value == null ? null : value.toString()); } else { log.info(String.format("property %s already exist on applicationlink %s with value %s", property.getMigratedKey(), applicationLink.getId(), applicationLink.getProperty(property.getMigratedKey()))); } } }
private void enableAddonUser(ConnectAddonBean addon) throws ConnectAddonInitException { String userKey = connectUserService.getOrCreateAddonUserName(addon.getKey(), addon.getName()); ApplicationLink applicationLink = connectApplinkManager.getAppLink(addon.getKey()); if (null != applicationLink) { applicationLink.putProperty(JwtConstants.AppLinks.ADD_ON_USER_KEY_PROPERTY_NAME, userKey); } else { log.error("Unable to set the ApplicationLink user key property for add-on '{}' because the add-on has no ApplicationLink!", addon.getKey()); } }
public void fix() throws FishEyeUpgradeException { for (ApplicationLink applicationLink : applicationLinkService.getApplicationLinks(FishEyeCrucibleApplicationType.class)) { //this comes from FishEyePropertyKeys.FISHEYE_CRUCIBLE_ENABLED , but hardcoding here in case //that class gets changed. String key = "fisheye.crucible.enabled"; try { FishEyeInstanceStoreImpl.CrucibleEnabledState value = FishEyeInstanceStoreImpl.CrucibleEnabledState.valueOf((String) applicationLink.getProperty(key)); //if an illegal exception is thrown, it means the property wasn't properly migrated correctly in a previous //upgrade task, hence catch the exception, and migrate it properly log.info(String.format("Property {%s}->{%s} does not require fixing.", key, value.name())); } catch (IllegalArgumentException e) { log.info(String.format("Found incorrectly migrated property {%s}->{%s}, fixing...", key, (String) applicationLink.getProperty(key))); final FishEyeInstance fishEyeInstance = fishEyeInstanceStore.getFishEyeInstance(applicationLinkIdMapper.fromApplicationId(applicationLink.getId())); applicationLink.putProperty(key, computeCrucibleState(fishEyeInstance).name()); log.info(String.format("Fix completed : {%s}->{%s}", key, (String) applicationLink.getProperty(key))); } } }
private void addTrustedApplication(ApplicationLink appLink, final Application application) { try { Iterables.find(trustedAppsManager.getTrustedApplications(), new Predicate<TrustedApplication>() { public boolean apply(final TrustedApplication input) { return input.getID().equals(application.getID()); } }); } catch (NoSuchElementException ex) { trustedAppsManager.addTrustedApplication(application, RequestConditions .builder() .setCertificateTimeout(DEFAULT_CERTIFICATE_TIMEOUT) .build()); } appLink.putProperty(TRUSTED_APPS_INCOMING_ID, application.getID()); }
public void issueInboundTrust(final ApplicationLink appLink) throws ConfigurationException { final Application application = getApplicationCertificate(appLink); checkNotNull(appLink, "applicationLink"); try { Iterables.find(trustedAppsManager.getTrustedApplications(), new Predicate<TrustedApplication>() { public boolean apply(@Nullable final TrustedApplication input) { return input.getID().equals(application.getID()); } }); } catch (NoSuchElementException ex) { trustedAppsManager.addTrustedApplication(application, RequestConditions .builder() .setCertificateTimeout(TrustConfigurator.DEFAULT_CERTIFICATE_TIMEOUT) .build()); } appLink.putProperty(AbstractTrustedAppsServlet.TRUSTED_APPS_INCOMING_ID, application.getID()); }
applicationLink.putProperty(SHARED_SECRET_PROPERTY_NAME, sharedSecret);
.build(); serviceProviderConsumerStore.put(updatedConsumer); link.putProperty(OAUTH_INCOMING_CONSUMER_KEY, updatedConsumer.getKey());