private String rebaseLinks(String jiraResponse, ApplicationLink appLink) { // CONF-22283: Display URL is not used when inserting jira issue return jiraResponse.replace(appLink.getRpcUrl().toString(), appLink.getDisplayUrl().toString()); }
@Override public boolean apply(ApplicationLink input) { return uri.startsWith(input.getRpcUrl().toString()) || uri.startsWith(input.getDisplayUrl().toString()); } }
@Override public boolean apply(ApplicationLink input) { return uri.startsWith(input.getRpcUrl().toString()) || uri.startsWith(input.getDisplayUrl().toString()); } }
public String getBaseUrlForKey(String projectKey) { ApplicationLink appLink = getAppForKey(projectKey); if (appLink != null) { return appLink.getRpcUrl().toString(); } return null; }
private ApplicationLink getApplicationLinkByRpcUrl(String rpcurl) { for (ApplicationLink link : applicationLinkService.getApplicationLinks()) { if (link.getRpcUrl().toString().equals(rpcurl)) { return link; } } throw new IllegalArgumentException("Application Link with rpcurl '" + rpcurl + "' doesn't exist."); } }
private boolean applicationLinkWithRpcUrlAlreadyExists(final URI rpcURl) { return stream(applicationLinkService.getApplicationLinks().spliterator(), false) .anyMatch(input -> (input.getRpcUrl().equals(rpcURl))); }
public Collection<ApplicationLink> getApplicationLinksByUri(URI uri) { List<ApplicationLink> matches = new ArrayList<>(); for (ApplicationLink link : linkService.getApplicationLinks()) { if (matchesOrigin(uri, link.getRpcUrl())) { matches.add(link); } } return matches; }
public static ServiceProvider getServiceProvider(Map<String, String> config, ApplicationLink applicationLink) { if (config.containsKey(AddServiceProviderManuallyServlet.CONSUMER_KEY_OUTBOUND)) { final String accessTokenUrl = makeAbsoluteUrl(config.get(AddServiceProviderManuallyServlet.SERVICE_PROVIDER_ACCESS_TOKEN_URL), applicationLink.getRpcUrl()); final String requestTokenUrl = makeAbsoluteUrl(config.get(AddServiceProviderManuallyServlet.SERVICE_PROVIDER_REQUEST_TOKEN_URL), applicationLink.getRpcUrl()); final String authorizeUrl = makeAbsoluteUrl(config.get(AddServiceProviderManuallyServlet.SERVICE_PROVIDER_AUTHORIZE_URL), applicationLink.getDisplayUrl()); return new ServiceProvider(URI.create(requestTokenUrl), URI.create(authorizeUrl), URI.create(accessTokenUrl)); } return ServiceProviderUtil.getServiceProvider(applicationLink.getRpcUrl(), applicationLink.getDisplayUrl()); }
private Application getApplicationCertificate(final ApplicationLink appLink) throws ConfigurationException { checkNotNull(appLink, "applicationLink"); try { return trustedAppsManager.getApplicationCertificate(appLink.getRpcUrl().toString()); } catch (ApplicationRetriever.RetrievalException re) { throw new ConfigurationException("Unable to retrieve the application's certificate: " + re.getMessage(), re); } }
private Application getApplicationCertificate(final ApplicationLink appLink) throws ConfigurationException { checkNotNull(appLink, "applicationLink"); try { return trustedAppsManager.getApplicationCertificate(appLink.getRpcUrl().toString()); } catch (ApplicationRetriever.RetrievalException re) { throw new ConfigurationException("Unable to retrieve the application's certificate: " + re.getMessage(), re); } }
public ApplinkEntity(ApplicationLink link) { this.id = link.getId().get(); this.name = link.getName(); this.displayUrl = link.getDisplayUrl().toASCIIString(); this.rpcUrl = link.getRpcUrl().toASCIIString(); this.applicationType = resolveAppType(link); this.typeId = this.applicationType; this.type = this.applicationType; } }
public boolean validateCallbackUriAgainstApplink(URI callbackUri, ApplicationLink applicationLink) { final boolean isValidByDisplayUrl = validateAbsoluteUri(applicationLink.getDisplayUrl(), callbackUri); final boolean isValidByRpcUrl = validateAbsoluteUri(applicationLink.getRpcUrl(), callbackUri); return isValidByDisplayUrl || isValidByRpcUrl; }
@Nonnull private RemoteApplicationCapabilities updateAndGet(@Nonnull ApplicationLink applink, @Nullable CachedCapabilities currentCapabilities) { try { Manifest manifest = manifestDownloader.downloadNoEvent(applink.getRpcUrl()); return updateAndGet(applink, manifest, currentCapabilities); } catch (ManifestNotFoundException e) { ApplinkError error = toApplinkError(e, "Failed to download manifest"); return updateAndGet(applink.getId(), currentCapabilities, withError(currentCapabilities, error)); } }
public boolean validateCallbackUriAgainstApplink(URI callbackUri, ApplicationLink applicationLink) { final boolean isValidByDisplayUrl = validateAbsoluteUri(applicationLink.getDisplayUrl(), callbackUri); final boolean isValidByRpcUrl = validateAbsoluteUri(applicationLink.getRpcUrl(), callbackUri); return isValidByDisplayUrl || isValidByRpcUrl; }
public ImmutableApplicationLink(final ApplicationLink that, final ApplicationLinkRequestFactoryFactory requestFactoryFactory) { checkNotNull(that, "that"); checkNotNull(requestFactoryFactory, "requestFactoryFactory"); this.applicationId = that.getId(); this.applicationType = that.getType(); this.name = that.getName(); this.displayUrl = that.getDisplayUrl(); this.rpcUrl = that.getRpcUrl(); this.isPrimary = that.isPrimary(); this.isSystem = that.isSystem(); this.requestFactoryFactory = requestFactoryFactory; }
public RestMinimalApplicationLink(@Nonnull ApplicationLink link) { requireNonNull(link, "link"); id = link.getId().get(); name = link.getName(); displayUrl = link.getDisplayUrl(); rpcUrl = link.getRpcUrl(); type = resolveApplicationTypeId(link.getType()); }
/** * Creates a new {@link com.atlassian.applinks.spi.link.ApplicationLinkDetails.Builder} * initialized with the state from the supplied * {@link com.atlassian.applinks.api.ApplicationLink} instance. */ public static Builder builder(final ApplicationLink applicationLink) { final Builder builder = new Builder(); builder.displayUrl = applicationLink.getDisplayUrl(); builder.rpcUrl = applicationLink.getRpcUrl(); builder.name = applicationLink.getName(); builder.isPrimary = applicationLink.isPrimary(); return builder; }
private String getAutoConfigServletUrl(ApplicationLink applink) { return RestUrl.forPath(applink.getRpcUrl().toASCIIString()) .add(ServletPathConstants.APPLINKS_CONFIG_SERVLET_URL) .add("oauth") .add("autoconfig") .add(internalHostApplication.getId().toString()) .toString(); }
private void addApplicationLinkInformation(SupportInfoBuilder builder) { for (ApplicationLink link : linkService.getApplicationLinks()) { SupportInfoBuilder linkBuilder = builder.addCategory(LINK); linkBuilder.addValue(LINK_NAME, link.getName()); linkBuilder.addValue(LINK_PRIMARY, String.valueOf(link.isPrimary())); linkBuilder.addValue(LINK_TYPE, link.getType().getI18nKey()); linkBuilder.addValue(LINK_DISPLAY_URL, link.getDisplayUrl().toString()); linkBuilder.addValue(LINK_RPC_URL, link.getRpcUrl().toString()); linkBuilder.addContext(link); } }
public ApplicationLinkEntity(final ApplicationLink applicationLink, final Link self) { this(applicationLink.getId(), TypeId.getTypeId(applicationLink.getType()), applicationLink.getName(), applicationLink.getDisplayUrl(), applicationLink.getType().getIconUrl(), resolveIconUri(applicationLink.getType()), applicationLink.getRpcUrl(), applicationLink.isPrimary(), applicationLink.isSystem(), self); }