@Override public boolean isJwtPeer(ApplicationLink applicationLink) { return applicationLink.getProperty(SHARED_SECRET_PROPERTY_NAME) != null; }
private String getProperty(String propertyName) { Object property = applicationLink.getProperty(propertyName); return (property instanceof String) ? (String) property : null; } }
/** * Get the string value from the given link. * * @param link the application link to get the value from * @return a string value. Possibily null. */ protected String getValue(ApplicationLink link) { return (String) link.getProperty(key); }
public boolean inboundTrustEnabled(ApplicationLink applicationLink) { return applicationLink.getProperty(TRUSTED_APPS_INCOMING_ID) != null; }
public boolean inboundTrustEnabled(ApplicationLink applicationLink) { return applicationLink.getProperty(AbstractTrustedAppsServlet.TRUSTED_APPS_INCOMING_ID) != null; }
private String getConsumerKey(final ApplicationLink applicationLink) { final Object storedConsumerKey = applicationLink.getProperty(PROPERTY_INCOMING_CONSUMER_KEY); if (storedConsumerKey != null) { return storedConsumerKey.toString(); } return null; }
private String getPluginKey(ApplicationLink link) { return String.valueOf(link.getProperty(DefaultConnectApplinkManager.PLUGIN_KEY_PROPERTY)); }
private static Map<String, Object> getProperties(ApplicationLink link, Set<String> propertyKeys) { Map<String, Object> properties = new LinkedHashMap<>(); for (String key : propertyKeys) { properties.put(key, link.getProperty(key)); } return properties; } }
private boolean isActivityEnabled(ApplicationLink applink) { // These are FeCru-internal properties that supposedly will never change. // See FE/src/java/com/atlassian/fisheye/jira/JiraServerImpl.java for details. Properties appLinkProperties = (Properties) applink.getProperty("SERVER_PROPERTIES"); return Boolean.parseBoolean(appLinkProperties != null ? appLinkProperties.getProperty("IS_ACTIVITY_ITEM_PROVIDER") : null); } }
private String getConsumerKey(final ApplicationLink applicationLink) { final Object storedConsumerKey = applicationLink.getProperty("oauth.incoming.consumerkey"); if (storedConsumerKey == null) { throw new RuntimeException("the OAuth consumer must be present"); } return storedConsumerKey.toString(); } }
private String requireSharedSecret(ApplicationLink applicationLink) { String sharedSecret = (String) applicationLink.getProperty(SHARED_SECRET_PROPERTY_NAME); if (sharedSecret == null) { throw new NotAJwtPeerException(applicationLink); } return sharedSecret; }
@GET @Path("getApplicationLink") public Response getApplicationLinkProperty(@QueryParam("propertyKey") String propertyKey) { final ApplicationLink applicationLink = applicationLinkService.getPrimaryApplicationLink(GenericApplicationType.class); Object propertyValue = applicationLink.getProperty(propertyKey); return ok("'" + propertyKey + "'='" + propertyValue + "'").build(); }
protected String getValue(ApplicationLink link, K projectKey) { return (String)link.getProperty(makeKey(projectKey)); }
@Override public Optional<String> getSharedSecretOrPublicKey(ApplicationLink applink) { Optional<AuthenticationType> maybeAuthType = ConnectApplinkUtil.getAuthenticationType(applink); if (maybeAuthType.isPresent()) { if (maybeAuthType.get().equals(AuthenticationType.JWT)) { Object prop = applink.getProperty(JwtConstants.AppLinks.SHARED_SECRET_PROPERTY_NAME); if (prop instanceof String) { return Optional.of((String) prop); } } } return Optional.empty(); }
public void revokeInboundTrust(final ApplicationLink appLink) { final Object value = appLink.getProperty(AbstractTrustedAppsServlet.TRUSTED_APPS_INCOMING_ID); if (value != null) { trustedAppsManager.deleteApplication(value.toString()); } appLink.removeProperty(AbstractTrustedAppsServlet.TRUSTED_APPS_INCOMING_ID); }
public void revokeInboundTrust(final ApplicationLink appLink) { final Object value = appLink.getProperty(TRUSTED_APPS_INCOMING_ID); if (value != null) { trustedAppsManager.deleteApplication(value.toString()); } appLink.removeProperty(TRUSTED_APPS_INCOMING_ID); }
@EventListener public void onApplicationLinkDeleted(final BeforeApplicationLinkDeletedEvent deletedEvent) { final ApplicationLink link = deletedEvent.getApplicationLink(); final Object value = link.getProperty(AbstractTrustedAppsServlet.TRUSTED_APPS_INCOMING_ID); if (value != null) { trustedAppsManager.deleteApplication(value.toString()); logger.debug("Removed certificate (trusted apps Id: {}) for deleted application link {}", value.toString(), link.getId()); } }
@Override public ApplicationLink getAppLink(String key) throws NotConnectAddonException { for (ApplicationLink link : applicationLinkService.getApplicationLinks()) { if (key.equals(link.getProperty(PLUGIN_KEY_PROPERTY))) { if (link.getType() instanceof RemotePluginContainerApplicationType) { return link; } else { throw new NotConnectAddonException("Plugin " + key + " does not seem to be a Connect add-on. It's type is: " + link.getType().getClass().getSimpleName()); } } } 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()))); } } }
protected void render(final String template, final Map<String, Object> params, HttpServletRequest request, final HttpServletResponse response, final ApplicationLink applicationLink) throws IOException { final RendererContextBuilder builder = new RendererContextBuilder(params); builder.put(ENABLED_CONTEXT_PARAM, applicationLink.getProperty(OAUTH_INCOMING_CONSUMER_KEY) != null); super.render(template, builder.build(), request, response); }