From 04af287cd7db92687770d780fa76d08178e65c87 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Tue, 16 Apr 2024 23:22:30 +0300 Subject: [PATCH 01/11] Platform 7 and REST v2 migration --- .../pom.xml | 46 +++++++++--- .../plugins/slack/ComponentImports.java | 2 +- .../listener/SlackActionEventListener.java | 2 +- .../slack/listener/UnfurlLinkExtractor.java | 2 +- .../slack/model/ReplyToCommentPayload.java | 4 +- .../plugins/slack/model/RepositoryDto.java | 4 +- .../renderer/SlackNotificationRenderer.java | 2 +- ...ositoryToChannelConfigurationResource.java | 3 +- .../rest/RepositoryToChannelResource.java | 2 + .../BitbucketSlackPluginResourceProvider.java | 4 +- .../src/main/resources/atlassian-plugin.xml | 6 ++ .../pom.xml | 29 +++++--- .../configuration/SlackChannelDefinition.java | 6 +- .../listener/SlackMessageEventListener.java | 2 +- .../spacetochannel/model/SpaceResult.java | 7 +- .../SpaceToChannelConfigurationResource.java | 3 +- .../rest/SpaceToChannelSpaceResource.java | 2 + .../ConfluenceSlackLinkAccessManager.java | 8 +-- .../src/main/resources/atlassian-plugin.xml | 6 ++ .../ConfluenceSlackLinkAccessManagerTest.java | 19 +++-- .../pom.xml | 70 ++++++++++-------- .../plugins/slack/model/DedicatedChannel.java | 2 +- .../slack/model/DedicatedChannelInfo.java | 9 +-- .../model/dto/ConfigurationGroupDTO.java | 6 +- .../model/dto/ConfigurationMigrationDTO.java | 11 ++- .../slack/model/dto/DedicatedChannelDTO.java | 10 +-- .../model/dto/ProjectConfigurationDTO.java | 12 ++-- .../dto/ProjectToChannelConfigurationDTO.java | 6 +- .../slack/model/mentions/IssueMention.java | 10 +-- .../IssueMentionViewResponseFactory.java | 6 +- .../slack/model/mentions/MentionChannel.java | 6 +- .../slack/model/mentions/MentionMessage.java | 6 +- .../slack/model/mentions/MentionUser.java | 6 +- .../postfunction/ChannelToNotifyDto.java | 4 +- .../spi/impl/JiraSlackLinkAccessManager.java | 8 +-- .../plugins/slack/storage/json/JsonStore.java | 2 +- .../system/CustomDateTimeSerializer.java | 8 +-- .../jira/plugins/slack/system/PluginInfo.java | 6 +- .../UserLoggedInUrlReadingCondition.java | 4 +- .../web/rest/ConfigurationRestService.java | 8 ++- .../web/rest/DedicatedChannelResource.java | 2 + .../slack/web/rest/IssuePanelResource.java | 4 +- .../slack/web/rest/PluginInfoResource.java | 4 +- .../rest/ProjectConfigurationResource.java | 2 + .../web/rest/SlackIssueMentionsResource.java | 2 + .../slack/web/rest/SlackMessageResource.java | 6 +- .../web/rest/SlackMigrationResource.java | 2 + .../src/main/resources/atlassian-plugin.xml | 6 ++ .../impl/JiraSlackLinkAccessManagerTest.java | 18 +++-- pom.xml | 71 ++++++------------- slack-server-integration-common/pom.xml | 26 ++++--- .../admin/InstallationCompletionData.java | 2 +- .../plugins/slack/ao/AOSlackUser.java | 2 +- .../slack/api/DelayedSlackMessage.java | 2 +- .../IsSlackEnabledUrlReadingCondition.java | 4 +- .../json/DefaultJsonableJacksonService.java | 4 +- .../api/notification/NotificationType.java | 8 +-- .../api/webhooks/AppHomeOpenedSlackEvent.java | 6 +- .../webhooks/AppUninstalledSlackEvent.java | 6 +- .../slack/api/webhooks/BaseChannelEvent.java | 2 +- .../webhooks/ChannelArchiveSlackEvent.java | 6 +- .../webhooks/ChannelDeletedSlackEvent.java | 6 +- .../webhooks/ChannelUnarchiveSlackEvent.java | 6 +- .../webhooks/GenericMessageSlackEvent.java | 10 +-- .../api/webhooks/LinkSharedSlackEvent.java | 4 +- .../MemberJoinedChannelSlackEvent.java | 8 +-- .../slack/api/webhooks/SlackEvent.java | 2 +- .../api/webhooks/TokensRevokedSlackEvent.java | 8 +-- .../api/webhooks/action/BlockKitAction.java | 6 +- .../api/webhooks/action/BlockSlackAction.java | 6 +- .../action/DialogSubmissionSlackAction.java | 6 +- .../api/webhooks/action/SlackAction.java | 2 +- .../slack/rest/ConnectionStatusResource.java | 8 ++- .../slack/rest/SlackChannelsResource.java | 3 +- .../rest/SlackLinkAdministerPermission.java | 10 +++ ...inkAdministerPermissionResourceFilter.java | 33 ++++----- .../plugins/slack/rest/SlackLinkResource.java | 17 ++--- ...LinkUninstallPermissionResourceFilter.java | 26 ++----- .../slack/rest/SlackOAuth2Resource.java | 5 +- .../rest/SlackSettingsRedirectResource.java | 6 +- .../slack/rest/SlackSignatureVerifying.java | 10 +++ .../rest/SlackSignatureVerifyingFilter.java | 43 +++++------ .../slack/rest/SlackUsersResource.java | 2 + .../slack/rest/SlackWebHookResource.java | 26 +++---- .../rest/model/GetWorkspacesResponse.java | 8 +-- .../slack/rest/model/LimitedSlackLinkDto.java | 6 +- .../slack/rest/model/OauthRequestData.java | 10 +-- .../slack/rest/model/SlackChannelDTO.java | 10 +-- .../slack/rest/model/SlackUserDto.java | 4 +- .../slack/rest/model/SlackWebHookPayload.java | 14 ++-- .../soy/SimpleJsonSerializeFunction.java | 2 +- .../slack/spi/SlackLinkAccessManager.java | 4 +- .../impl/AbstractSlackLinkAccessManager.java | 4 +- .../plugins/slack/util/ErrorResponse.java | 8 +-- .../plugins/slack/util/ResponseMapper.java | 6 +- .../DefaultJsonableJacksonServiceTest.java | 6 +- 96 files changed, 477 insertions(+), 402 deletions(-) create mode 100644 slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermission.java create mode 100644 slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifying.java diff --git a/bitbucket-slack-server-integration-plugin/pom.xml b/bitbucket-slack-server-integration-plugin/pom.xml index 1ffe4f89..1d3215b8 100644 --- a/bitbucket-slack-server-integration-plugin/pom.xml +++ b/bitbucket-slack-server-integration-plugin/pom.xml @@ -50,21 +50,28 @@ 7.6.0 ${bitbucket.version} 8.2.2 - 5.0.0 + 7.0.0-m40 - com.atlassian.platform - platform + com.atlassian.platform.dependencies + platform-public-api ${platform.version} pom import - com.atlassian.platform - third-party + com.atlassian.platform.dependencies + platform-test-resources + ${platform.version} + pom + import + + + com.atlassian.platform.dependencies + platform-internal-api ${platform.version} pom import @@ -166,9 +173,29 @@ com.atlassian.plugins.rest - atlassian-rest-common + atlassian-rest-v2-api + provided + + + javax.inject + javax.inject provided + + com.fasterxml.jackson.core + jackson-annotations + provided + + + com.fasterxml.jackson.core + jackson-databind + provided + + + org.glassfish.jersey.core + jersey-common + 2.42 + com.atlassian.soy soy-template-renderer-api @@ -242,9 +269,8 @@ provided - javax.ws.rs - jsr311-api - 1.1.1 + jakarta.ws.rs + jakarta.ws.rs-api provided @@ -313,11 +339,13 @@ org.hamcrest hamcrest-library + 2.2 test org.hamcrest hamcrest-core + 2.2 test diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/ComponentImports.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/ComponentImports.java index 691882b4..77c4b3e6 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/ComponentImports.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/ComponentImports.java @@ -22,7 +22,6 @@ import com.atlassian.plugin.module.ModuleFactory; import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport; import com.atlassian.plugin.web.WebInterfaceManager; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.sal.api.ApplicationProperties; import com.atlassian.sal.api.auth.LoginUriProvider; import com.atlassian.sal.api.executor.ThreadLocalDelegateExecutorFactory; @@ -35,6 +34,7 @@ import com.atlassian.sal.api.web.context.HttpContext; import com.atlassian.soy.renderer.SoyTemplateRenderer; import com.atlassian.templaterenderer.TemplateRenderer; +import com.atlassian.webresource.api.WebResourceUrlProvider; import com.atlassian.webresource.api.assembler.PageBuilderService; @SuppressWarnings("unused") diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/SlackActionEventListener.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/SlackActionEventListener.java index a8282b79..3bd5bba0 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/SlackActionEventListener.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/SlackActionEventListener.java @@ -14,10 +14,10 @@ import com.atlassian.plugins.slack.util.AsyncExecutor; import com.atlassian.plugins.slack.util.ErrorResponse; import com.atlassian.sal.api.message.I18nResolver; +import com.fasterxml.jackson.databind.ObjectMapper; import com.github.seratch.jslack.api.model.dialog.Dialog; import com.github.seratch.jslack.api.model.dialog.DialogElement; import com.github.seratch.jslack.api.model.dialog.DialogTextAreaElement; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java index 53857010..6ceeb23f 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java @@ -22,8 +22,8 @@ import com.atlassian.sal.api.ApplicationProperties; import com.atlassian.sal.api.UrlMode; import com.google.common.primitives.Ints; -import com.sun.jersey.api.uri.UriComponent; import org.apache.commons.lang3.StringUtils; +import org.glassfish.jersey.uri.UriComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/ReplyToCommentPayload.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/ReplyToCommentPayload.java index bbf57ade..3d8ec742 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/ReplyToCommentPayload.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/ReplyToCommentPayload.java @@ -1,7 +1,7 @@ package com.atlassian.bitbucket.plugins.slack.model; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; public class ReplyToCommentPayload { public static final String TYPE_PULL_REQUEST = "pullRequest"; diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/RepositoryDto.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/RepositoryDto.java index a38bb612..4dba28ff 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/RepositoryDto.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/model/RepositoryDto.java @@ -1,9 +1,9 @@ package com.atlassian.bitbucket.plugins.slack.model; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import lombok.Value; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @JsonAutoDetect(fieldVisibility = PUBLIC_ONLY) @Value diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackNotificationRenderer.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackNotificationRenderer.java index d57a058e..2c450b10 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackNotificationRenderer.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackNotificationRenderer.java @@ -38,6 +38,7 @@ import com.atlassian.plugins.slack.api.notification.Verbosity; import com.atlassian.plugins.slack.settings.SlackSettingService; import com.atlassian.sal.api.message.I18nResolver; +import com.fasterxml.jackson.databind.ObjectMapper; import com.github.seratch.jslack.api.methods.request.chat.ChatPostMessageRequest; import com.github.seratch.jslack.api.methods.request.chat.ChatPostMessageRequest.ChatPostMessageRequestBuilder; import com.github.seratch.jslack.api.model.block.ActionsBlock; @@ -48,7 +49,6 @@ import com.github.seratch.jslack.api.model.block.element.BlockElement; import com.github.seratch.jslack.api.model.block.element.ButtonElement; import com.google.common.base.Preconditions; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelConfigurationResource.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelConfigurationResource.java index c382c466..77b3d99f 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelConfigurationResource.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelConfigurationResource.java @@ -19,6 +19,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.PUT; @@ -35,7 +36,7 @@ */ @Path("/config/{repositoryId}") @Slf4j -@RequiredArgsConstructor +@RequiredArgsConstructor(onConstructor_ = @Inject) public class RepositoryToChannelConfigurationResource { private final RepositoryService repositoryService; private final PermissionValidationService permissionValidationService; diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelResource.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelResource.java index a66d733c..6334030b 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelResource.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/rest/RepositoryToChannelResource.java @@ -9,6 +9,7 @@ import com.atlassian.bitbucket.util.PageUtils; import org.apache.commons.lang3.StringUtils; +import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -26,6 +27,7 @@ public class RepositoryToChannelResource { private final RepositoryService repositoryService; + @Inject public RepositoryToChannelResource(final RepositoryService repositoryService) { this.repositoryService = repositoryService; } diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/spi/impl/BitbucketSlackPluginResourceProvider.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/spi/impl/BitbucketSlackPluginResourceProvider.java index 7afd47c2..d98a5282 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/spi/impl/BitbucketSlackPluginResourceProvider.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/spi/impl/BitbucketSlackPluginResourceProvider.java @@ -1,9 +1,9 @@ package com.atlassian.bitbucket.plugins.slack.spi.impl; import com.atlassian.bitbucket.plugins.slack.notification.BitbucketPersonalNotificationTypes; -import com.atlassian.plugin.webresource.UrlMode; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.plugins.slack.spi.SlackPluginResourceProvider; +import com.atlassian.webresource.api.UrlMode; +import com.atlassian.webresource.api.WebResourceUrlProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bitbucket-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml b/bitbucket-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml index a06a0791..a2732a95 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml +++ b/bitbucket-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml @@ -185,6 +185,12 @@ + + + + + + REQUEST FORWARD diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml index 8f0522e2..efb64bff 100755 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml @@ -77,6 +77,14 @@ daisydiff org.outerj.daisy + + jackson-mapper-asl + org.codehaus.jackson + + + jackson-core-asl + org.codehaus.jackson + @@ -104,17 +112,20 @@ provided - org.codehaus.jackson - jackson-core-asl - 1.9.13-atlassian-1 + com.fasterxml.jackson.core + jackson-annotations provided - org.codehaus.jackson - jackson-mapper-asl - 1.9.13-atlassian-1 + com.fasterxml.jackson.core + jackson-databind provided + + org.glassfish.jersey.core + jersey-common + 2.42 + commons-codec commons-codec @@ -152,7 +163,7 @@ com.atlassian.plugins.rest - atlassian-rest-common + atlassian-rest-v2-api provided @@ -333,7 +344,6 @@ com.atlassian.plugin.webresource.transformer, com.atlassian.plugin.webresource.url, com.atlassian.plugin.servlet, - com.atlassian.plugins.rest.common.security, com.atlassian.sal.api, com.atlassian.sal.api.executor, com.atlassian.sal.api.lifecycle, @@ -351,8 +361,6 @@ com.google.common.base, com.google.common.collect, - com.sun.jersey.api.view, - com.sun.jersey.api.uri, javax.annotation, javax.inject, javax.naming, @@ -374,7 +382,6 @@ org.apache.velocity, org.apache.velocity.runtime, org.apache.velocity.app.event, - org.codehaus.jackson.annotate, org.springframework.aop.support, org.springframework.beans, org.springframework.beans.factory, diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/configuration/SlackChannelDefinition.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/configuration/SlackChannelDefinition.java index bd816961..6d0fa552 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/configuration/SlackChannelDefinition.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/configuration/SlackChannelDefinition.java @@ -1,9 +1,9 @@ package com.atlassian.confluence.plugins.slack.spacetochannel.configuration; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; import java.util.Comparator; import java.util.Objects; diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java index fb3b1137..dcd80417 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java @@ -47,10 +47,10 @@ import com.github.seratch.jslack.api.methods.request.chat.ChatPostEphemeralRequest; import com.github.seratch.jslack.api.methods.request.chat.ChatPostMessageRequest; import com.github.seratch.jslack.api.model.Attachment; -import com.sun.jersey.api.uri.UriComponent; import io.atlassian.fugue.Pair; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.glassfish.jersey.uri.UriComponent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/model/SpaceResult.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/model/SpaceResult.java index 275dda21..e800886c 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/model/SpaceResult.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/model/SpaceResult.java @@ -1,8 +1,9 @@ package com.atlassian.confluence.plugins.slack.spacetochannel.model; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelConfigurationResource.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelConfigurationResource.java index f8f6b9c8..3eb7271d 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelConfigurationResource.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelConfigurationResource.java @@ -25,6 +25,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.PUT; @@ -47,7 +48,7 @@ @ReadOnlyAccessAllowed @Path("/config/{spaceKey}") @Slf4j -@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RequiredArgsConstructor(onConstructor_ = {@Autowired, @Inject}) public class SpaceToChannelConfigurationResource { private final SpaceManager spaceManager; private final PermissionManager permissionManager; diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelSpaceResource.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelSpaceResource.java index 7780e0ca..c03ec250 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelSpaceResource.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/rest/SpaceToChannelSpaceResource.java @@ -5,6 +5,7 @@ import com.atlassian.confluence.user.ConfluenceUser; import org.apache.commons.lang3.StringUtils; +import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -19,6 +20,7 @@ public class SpaceToChannelSpaceResource { private final SpacesWithAdminPermissionProvider defaultSpacesWithAdminPermissionProvider; + @Inject public SpaceToChannelSpaceResource(final SpacesWithAdminPermissionProvider defaultSpacesWithAdminPermissionProvider) { this.defaultSpacesWithAdminPermissionProvider = defaultSpacesWithAdminPermissionProvider; } diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManager.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManager.java index 6a17f87a..f5200672 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManager.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManager.java @@ -8,13 +8,13 @@ import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; import com.atlassian.user.User; -import com.sun.jersey.spi.container.ContainerRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.MultivaluedMap; import java.util.Optional; @@ -50,7 +50,7 @@ private boolean hasAccess(UserProfile userProfile, Optional space) { } @Override - public boolean hasAccess(UserProfile userProfile, ContainerRequest request) { + public boolean hasAccess(UserProfile userProfile, ContainerRequestContext request) { if (super.hasAccess(userProfile, request)) { return true; } @@ -70,8 +70,8 @@ public boolean hasAccess(UserProfile userProfile, HttpServletRequest request) { return hasAccess(userProfile, space); } - private Optional getSpace(ContainerRequest request) { - MultivaluedMap params = request.getQueryParameters(); + private Optional getSpace(ContainerRequestContext request) { + MultivaluedMap params = request.getUriInfo().getQueryParameters(); String spaceKey = params.getFirst("key"); return getSpaceFromKey(spaceKey); diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml index 001e08cc..ded61299 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml @@ -205,6 +205,12 @@ + + + + + + REQUEST FORWARD diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/test/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManagerTest.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/test/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManagerTest.java index d5e9feda..d3c3a170 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/test/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManagerTest.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/test/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackLinkAccessManagerTest.java @@ -9,7 +9,6 @@ import com.atlassian.sal.api.user.UserKey; import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; -import com.sun.jersey.spi.container.ContainerRequest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -18,12 +17,16 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriInfo; import static com.atlassian.confluence.plugins.slack.spi.impl.ConfluenceConfigurationRedirectionManager.FROM_SPACE_ATTRIBUTE_KEY; import static com.atlassian.confluence.plugins.slack.spi.impl.ConfluenceConfigurationRedirectionManager.SPACE_ATTRIBUTE_KEY; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -50,7 +53,7 @@ public class ConfluenceSlackLinkAccessManagerTest { @Mock private HttpServletRequest httpServletRequest; @Mock - private ContainerRequest containerRequest; + private ContainerRequestContext containerRequest; @Mock private HttpSession session; @Mock @@ -85,7 +88,9 @@ public void hasAccess_containerRequest_grantAccessForSpaceAdmin() { when(userManager.isAdmin(userKey)).thenReturn(false); when(userManager.isSystemAdmin(userKey)).thenReturn(false); when(userProfile.getUserKey()).thenReturn(userKey); - when(containerRequest.getQueryParameters()).thenReturn(map); + UriInfo mockUriInfo = mock(UriInfo.class); + when(containerRequest.getUriInfo()).thenReturn(mockUriInfo); + when(mockUriInfo.getQueryParameters()).thenReturn(map); when(map.getFirst("key")).thenReturn(SPACE_KEY); when(spaceManager.getSpace(SPACE_KEY)).thenReturn(space); when(userAccessor.getExistingUserByKey(userKey)).thenReturn(user); @@ -101,7 +106,9 @@ public void hasAccess_containerRequest_notGrantAccessForNonSpaceAdmin() { when(userManager.isAdmin(userKey)).thenReturn(false); when(userManager.isSystemAdmin(userKey)).thenReturn(false); when(userProfile.getUserKey()).thenReturn(userKey); - when(containerRequest.getQueryParameters()).thenReturn(map); + UriInfo mockUriInfo = mock(UriInfo.class); + when(containerRequest.getUriInfo()).thenReturn(mockUriInfo); + when(mockUriInfo.getQueryParameters()).thenReturn(map); when(map.getFirst("key")).thenReturn(SPACE_KEY); when(spaceManager.getSpace(SPACE_KEY)).thenReturn(space); when(userAccessor.getExistingUserByKey(userKey)).thenReturn(user); @@ -117,7 +124,9 @@ public void hasAccess_containerRequest_notGrantAccessForNonExistingSpace() { when(userManager.isAdmin(userKey)).thenReturn(false); when(userManager.isSystemAdmin(userKey)).thenReturn(false); when(userProfile.getUserKey()).thenReturn(userKey); - when(containerRequest.getQueryParameters()).thenReturn(map); + UriInfo mockUriInfo = mock(UriInfo.class); + when(containerRequest.getUriInfo()).thenReturn(mockUriInfo); + when(mockUriInfo.getQueryParameters()).thenReturn(map); when(map.getFirst("key")).thenReturn(SPACE_KEY); when(spaceManager.getSpace(SPACE_KEY)).thenReturn(null); diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml index c7bd909d..82fa3bfa 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml @@ -71,6 +71,10 @@ jackson-mapper-asl org.codehaus.jackson + + jackson-core-asl + org.codehaus.jackson + @@ -94,8 +98,8 @@ provided - javax.ws.rs - jsr311-api + jakarta.ws.rs + jakarta.ws.rs-api provided @@ -135,7 +139,7 @@ com.atlassian.plugins.rest - atlassian-rest-common + atlassian-rest-v2-api provided @@ -173,15 +177,14 @@ provided - - org.codehaus.jackson - jackson-core-asl + com.fasterxml.jackson.core + jackson-annotations provided - org.codehaus.jackson - jackson-mapper-asl + com.fasterxml.jackson.core + jackson-databind provided @@ -249,6 +252,20 @@ com.atlassian.jira atlassian-jira-pageobjects test + + + jackson-mapper-asl + org.codehaus.jackson + + + jackson-core-asl + org.codehaus.jackson + + + com.atlassian.plugins.rest + atlassian-rest-common + + com.atlassian.jira @@ -279,6 +296,20 @@ com.atlassian.jira.tests jira-testkit-client test + + + com.sun.jersey + jersey-core + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-server + + com.atlassian @@ -296,26 +327,6 @@ atlassian-spring-scanner-annotation provided - - - - com.fasterxml.jackson.core - jackson-core - 2.9.2 - test - - - org.codehaus.jackson - jackson-jaxrs - 1.9.1 - test - - - org.codehaus.jackson - jackson-xc - 1.9.1 - test - @@ -459,7 +470,6 @@ com.atlassian.plugin.webresource.transformer, com.atlassian.plugin.webresource.url, com.atlassian.plugin.servlet, - com.atlassian.plugins.rest.common.security, com.atlassian.query, com.atlassian.query.clause, com.atlassian.query.operand, @@ -478,7 +488,6 @@ com.google.common.base, com.google.common.collect, - com.sun.jersey.api.view, javax.annotation, javax.inject, javax.naming, @@ -500,7 +509,6 @@ org.apache.velocity, org.apache.velocity.runtime, org.apache.velocity.app.event, - org.codehaus.jackson.annotate, org.springframework.beans, org.springframework.beans.factory, org.springframework.beans.factory.annotation, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannel.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannel.java index 915676ea..d4a52dfe 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannel.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannel.java @@ -2,7 +2,7 @@ import com.atlassian.jira.plugins.slack.model.dto.DedicatedChannelDTO; import com.atlassian.jira.plugins.slack.storage.StorableEntity; -import org.codehaus.jackson.map.annotate.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize(as = DedicatedChannelDTO.class) public interface DedicatedChannel extends StorableEntity { diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannelInfo.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannelInfo.java index 0a9d043a..d194675f 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannelInfo.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/DedicatedChannelInfo.java @@ -1,10 +1,11 @@ package com.atlassian.jira.plugins.slack.model; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = ANY) diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationGroupDTO.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationGroupDTO.java index fdc660a6..fb0ccaf9 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationGroupDTO.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationGroupDTO.java @@ -1,13 +1,13 @@ package com.atlassian.jira.plugins.slack.model.dto; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /** * This object contains the configuration from a specific group diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationMigrationDTO.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationMigrationDTO.java index 482e5938..0f9fa5ee 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationMigrationDTO.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ConfigurationMigrationDTO.java @@ -1,14 +1,13 @@ package com.atlassian.jira.plugins.slack.model.dto; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; - +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = ANY) diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/DedicatedChannelDTO.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/DedicatedChannelDTO.java index 311af59c..d1f9b3f4 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/DedicatedChannelDTO.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/DedicatedChannelDTO.java @@ -1,12 +1,12 @@ package com.atlassian.jira.plugins.slack.model.dto; import com.atlassian.jira.plugins.slack.model.DedicatedChannel; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = ANY) diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectConfigurationDTO.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectConfigurationDTO.java index e3898950..92a96dba 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectConfigurationDTO.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectConfigurationDTO.java @@ -4,18 +4,18 @@ import com.atlassian.jira.plugins.slack.model.EventMatcherType; import com.atlassian.jira.plugins.slack.model.ProjectConfiguration; import com.atlassian.jira.project.Project; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Strings; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; import java.util.UUID; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.isNullOrEmpty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; /** * This object will represent a configuration item that maps a project to a channel. diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectToChannelConfigurationDTO.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectToChannelConfigurationDTO.java index 47af8e64..c38e60f8 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectToChannelConfigurationDTO.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/dto/ProjectToChannelConfigurationDTO.java @@ -2,15 +2,15 @@ import com.atlassian.plugins.slack.api.ConversationKey; import com.atlassian.plugins.slack.rest.model.SlackChannelDTO; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.google.common.collect.Maps; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /** * This class contains all configuration for a project: diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMention.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMention.java index dbc5af52..acd1ad97 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMention.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMention.java @@ -1,18 +1,18 @@ package com.atlassian.jira.plugins.slack.model.mentions; import com.atlassian.jira.plugins.slack.storage.StorableEntity; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import javax.annotation.Nonnull; import java.util.Date; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Strings.isNullOrEmpty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; /** * A single issue mention diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMentionViewResponseFactory.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMentionViewResponseFactory.java index 8d3a5551..b3adae94 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMentionViewResponseFactory.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/IssueMentionViewResponseFactory.java @@ -6,8 +6,8 @@ import com.atlassian.jira.plugins.slack.mentions.storage.cache.MentionUserCacheManager; import com.atlassian.jira.plugins.slack.model.ChannelKeyImpl; import com.atlassian.jira.plugins.slack.model.UserIdImpl; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,10 +20,10 @@ import java.util.stream.Stream; import static com.atlassian.plugins.slack.util.SlackHelper.escapeSignsForSlackLink; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Strings.isNullOrEmpty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; /** * Json storage object containing all the Slack mentions for a Jira issue in one channel diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionChannel.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionChannel.java index 92117a82..d3f53d71 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionChannel.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionChannel.java @@ -2,15 +2,15 @@ import com.atlassian.jira.plugins.slack.model.ChannelKey; import com.atlassian.jira.plugins.slack.storage.cache.CacheableEntity; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.github.seratch.jslack.api.model.Conversation; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; import javax.annotation.Nonnull; import java.util.Objects; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; import static com.google.common.base.Preconditions.checkNotNull; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; /** * An Issue Mention Channel diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionMessage.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionMessage.java index 08a6b993..058a6cf8 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionMessage.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionMessage.java @@ -2,12 +2,12 @@ import com.atlassian.jira.plugins.slack.model.mentions.cache.MentionMessageKey; import com.atlassian.jira.plugins.slack.storage.cache.CacheableEntity; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.isNullOrEmpty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; /** * An Issue Mention Message diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionUser.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionUser.java index de6f4ba0..c4018620 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionUser.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/model/mentions/MentionUser.java @@ -3,14 +3,14 @@ import com.atlassian.jira.plugins.slack.model.UserId; import com.atlassian.jira.plugins.slack.model.UserIdImpl; import com.atlassian.jira.plugins.slack.storage.cache.CacheableEntity; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.github.seratch.jslack.api.model.User; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; import javax.annotation.Nonnull; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; import static com.google.common.base.Preconditions.checkNotNull; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; @SuppressWarnings("unused") @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/postfunction/ChannelToNotifyDto.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/postfunction/ChannelToNotifyDto.java index d3a5da9e..d6ff3c3b 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/postfunction/ChannelToNotifyDto.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/postfunction/ChannelToNotifyDto.java @@ -1,7 +1,7 @@ package com.atlassian.jira.plugins.slack.postfunction; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.TypeReference; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.List; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManager.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManager.java index 111ac6cf..8cc2a29f 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManager.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManager.java @@ -9,13 +9,13 @@ import com.atlassian.plugins.slack.spi.impl.AbstractSlackLinkAccessManager; import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; -import com.sun.jersey.spi.container.ContainerRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.MultivaluedMap; import java.util.Optional; @@ -48,7 +48,7 @@ private boolean hasAccess(final UserProfile userProfile, final Optional } @Override - public boolean hasAccess(final UserProfile userProfile, final ContainerRequest request) { + public boolean hasAccess(final UserProfile userProfile, final ContainerRequestContext request) { if (super.hasAccess(userProfile, request)) { return true; } @@ -65,8 +65,8 @@ public boolean hasAccess(final UserProfile userProfile, final HttpServletRequest return hasAccess(userProfile, getProject(request)); } - private Optional getProject(final ContainerRequest request) { - final MultivaluedMap params = request.getQueryParameters(); + private Optional getProject(final ContainerRequestContext request) { + final MultivaluedMap params = request.getUriInfo().getQueryParameters(); return getProjectFromKey(params.getFirst("projectKey")); } diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/storage/json/JsonStore.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/storage/json/JsonStore.java index 1177544d..d46b6247 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/storage/json/JsonStore.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/storage/json/JsonStore.java @@ -3,9 +3,9 @@ import com.atlassian.jira.entity.property.EntityProperty; import com.atlassian.jira.entity.property.JsonEntityPropertyManager; import com.atlassian.jira.plugins.slack.storage.StorableEntity; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/CustomDateTimeSerializer.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/CustomDateTimeSerializer.java index 670bb52c..90ef8841 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/CustomDateTimeSerializer.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/CustomDateTimeSerializer.java @@ -1,9 +1,9 @@ package com.atlassian.jira.plugins.slack.system; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; import javax.annotation.Nonnull; import java.io.IOException; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/PluginInfo.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/PluginInfo.java index 80c108ed..90777890 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/PluginInfo.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/system/PluginInfo.java @@ -1,8 +1,8 @@ package com.atlassian.jira.plugins.slack.system; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonSerialize; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.util.Date; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/condition/UserLoggedInUrlReadingCondition.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/condition/UserLoggedInUrlReadingCondition.java index 02765ce4..62aa3974 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/condition/UserLoggedInUrlReadingCondition.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/condition/UserLoggedInUrlReadingCondition.java @@ -2,7 +2,7 @@ import com.atlassian.jira.security.JiraAuthenticationContext; import com.atlassian.plugin.PluginParseException; -import com.atlassian.plugin.webresource.condition.SimpleUrlReadingCondition; +import com.atlassian.webresource.spi.condition.AbstractBooleanUrlReadingCondition; import java.util.Map; @@ -12,7 +12,7 @@ * Copied from com.atlassian.confluence.plugin.descriptor.web.UserLoggedInUrlReadingCondition for backward compatibility * with Confluence 5.3 */ -public class UserLoggedInUrlReadingCondition extends SimpleUrlReadingCondition { +public class UserLoggedInUrlReadingCondition extends AbstractBooleanUrlReadingCondition { private static final String USER_LOGGED_IN_QUERY_PARAM = "user-logged-in"; private final JiraAuthenticationContext context; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ConfigurationRestService.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ConfigurationRestService.java index 2511ce3d..d58ddb52 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ConfigurationRestService.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ConfigurationRestService.java @@ -12,13 +12,14 @@ import com.atlassian.plugins.slack.rest.model.LimitedSlackLinkDto; import com.atlassian.sal.api.user.UserKey; import com.atlassian.sal.api.user.UserManager; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Value; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -47,6 +48,7 @@ public class ConfigurationRestService { private final SlackLinkManager slackLinkManager; private final JiraSettingsService jiraSettingsService; + @Inject @Autowired public ConfigurationRestService(final PluginConfigurationManager pluginConfigurationManager, final ProjectConfigurationManager projectConfigurationManager, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/DedicatedChannelResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/DedicatedChannelResource.java index 29184c3a..f0cb150f 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/DedicatedChannelResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/DedicatedChannelResource.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -33,6 +34,7 @@ public class DedicatedChannelResource { private final PermissionManager permissionManager; private final JiraAuthenticationContext jiraAuthenticationContext; + @Inject @Autowired public DedicatedChannelResource(final DedicatedChannelManager dedicatedChannelManager, final IssueManager issueManager, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResource.java index e33a4034..248ea70f 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResource.java @@ -19,10 +19,11 @@ import com.atlassian.plugins.slack.spi.SlackLinkAccessManager; import com.atlassian.plugins.slack.user.SlackUserManager; import com.atlassian.sal.api.user.UserManager; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -54,6 +55,7 @@ public class IssuePanelResource { private final SlackLinkManager slackLinkManager; private final SlackClientProvider slackClientProvider; + @Inject @Autowired public IssuePanelResource(final PluginConfigurationManager pluginConfigurationManager, final SlackLinkAccessManager slackLinkAccessManager, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/PluginInfoResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/PluginInfoResource.java index 2b9757d9..8e6a9fc6 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/PluginInfoResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/PluginInfoResource.java @@ -1,7 +1,7 @@ package com.atlassian.jira.plugins.slack.web.rest; import com.atlassian.jira.plugins.slack.system.PluginInfoSource; -import com.atlassian.plugins.rest.common.security.AnonymousAllowed; +import com.atlassian.plugins.rest.api.security.annotation.AnonymousSiteAccess; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -13,7 +13,7 @@ /** * Rest Endpoint that will let us validate the configuration of the plugin */ -@AnonymousAllowed +@AnonymousSiteAccess @Path("/info") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ProjectConfigurationResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ProjectConfigurationResource.java index 45f52be2..a468546a 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ProjectConfigurationResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/ProjectConfigurationResource.java @@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.POST; @@ -42,6 +43,7 @@ public class ProjectConfigurationResource { private final GlobalPermissionManager globalPermissionManager; private final JiraAuthenticationContext authenticationContext; + @Inject @Autowired public ProjectConfigurationResource(final ProjectConfigurationManager projectConfigurationManager, final ProjectManager projectManager, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackIssueMentionsResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackIssueMentionsResource.java index ab45c893..14adb71b 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackIssueMentionsResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackIssueMentionsResource.java @@ -18,6 +18,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -43,6 +44,7 @@ public class SlackIssueMentionsResource { private final EventPublisher eventPublisher; private final AnalyticsContextProvider analyticsContextProvider; + @Inject public SlackIssueMentionsResource(final UserManager userManager, final IssueMentionService issueMentionService, final IssueManager issueManager, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMessageResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMessageResource.java index 2d8ff1ef..22fb4000 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMessageResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMessageResource.java @@ -24,15 +24,16 @@ import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.util.I18nHelper; import com.atlassian.templaterenderer.RenderingException; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import com.github.seratch.jslack.api.methods.request.chat.ChatPostMessageRequest; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; import org.ofbiz.core.entity.GenericValue; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -54,6 +55,7 @@ public class SlackMessageResource { private final JiraPostFunctionEventRenderer eventRenderer; private final JiraAuthenticationContext authenticationContext; + @Inject @Autowired public SlackMessageResource(final JiraPostFunctionEventRenderer eventRenderer, final JiraAuthenticationContext authenticationContext) { diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMigrationResource.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMigrationResource.java index 16ee85de..7cf3cd8e 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMigrationResource.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/web/rest/SlackMigrationResource.java @@ -6,6 +6,7 @@ import com.atlassian.plugins.slack.rest.model.SlackChannelDTO; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -20,6 +21,7 @@ public class SlackMigrationResource { private final SlackLinkManager slackLinkManager; private final SlackClientProvider slackClientProvider; + @Inject @Autowired public SlackMigrationResource(final SlackLinkManager slackLinkManager, final SlackClientProvider slackClientProvider) { diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml index dfbd7b4a..04518ac9 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml @@ -261,6 +261,12 @@ + + + + + + REQUEST FORWARD diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManagerTest.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManagerTest.java index d35700fb..542d87b0 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManagerTest.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackLinkAccessManagerTest.java @@ -8,7 +8,6 @@ import com.atlassian.sal.api.user.UserKey; import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; -import com.sun.jersey.spi.container.ContainerRequest; import org.junit.Rule; import org.junit.Test; import org.mockito.InjectMocks; @@ -18,12 +17,15 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriInfo; import static com.atlassian.jira.plugins.slack.spi.impl.JiraConfigurationRedirectionManager.FROM_PROJECT_ATTRIBUTE_KEY; import static com.atlassian.jira.plugins.slack.spi.impl.JiraConfigurationRedirectionManager.PROJECT_ATTRIBUTE_KEY; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class JiraSlackLinkAccessManagerTest { @@ -49,7 +51,7 @@ public class JiraSlackLinkAccessManagerTest { @Mock private HttpServletRequest httpServletRequest; @Mock - private ContainerRequest containerRequest; + private ContainerRequestContext containerRequest; @Mock private HttpSession session; @Mock @@ -87,7 +89,9 @@ public void hasAccess_containerRequest_grantAccessForProjectAdmin() { when(salUserManager.isAdmin(userKey)).thenReturn(false); when(salUserManager.isSystemAdmin(userKey)).thenReturn(false); when(userProfile.getUserKey()).thenReturn(userKey); - when(containerRequest.getQueryParameters()).thenReturn(map); + UriInfo mockUriInfo = mock(UriInfo.class); + when(containerRequest.getUriInfo()).thenReturn(mockUriInfo); + when(mockUriInfo.getQueryParameters()).thenReturn(map); when(map.getFirst("projectKey")).thenReturn(PROJECT); when(projectManager.getProjectByCurrentKey(PROJECT)).thenReturn(project); when(jiraUserManager.getUserByKeyEvenWhenUnknown(USER)).thenReturn(applicationUser); @@ -103,7 +107,9 @@ public void hasAccess_containerRequest_notGrantAccessForNonProjectAdmin() { when(salUserManager.isAdmin(userKey)).thenReturn(false); when(salUserManager.isSystemAdmin(userKey)).thenReturn(false); when(userProfile.getUserKey()).thenReturn(userKey); - when(containerRequest.getQueryParameters()).thenReturn(map); + UriInfo mockUriInfo = mock(UriInfo.class); + when(containerRequest.getUriInfo()).thenReturn(mockUriInfo); + when(mockUriInfo.getQueryParameters()).thenReturn(map); when(map.getFirst("projectKey")).thenReturn(PROJECT); when(projectManager.getProjectByCurrentKey(PROJECT)).thenReturn(project); when(jiraUserManager.getUserByKeyEvenWhenUnknown(USER)).thenReturn(applicationUser); @@ -119,7 +125,9 @@ public void hasAccess_containerRequest_notGrantAccessForNonExistingProject() { when(salUserManager.isAdmin(userKey)).thenReturn(false); when(salUserManager.isSystemAdmin(userKey)).thenReturn(false); when(userProfile.getUserKey()).thenReturn(userKey); - when(containerRequest.getQueryParameters()).thenReturn(map); + UriInfo mockUriInfo = mock(UriInfo.class); + when(containerRequest.getUriInfo()).thenReturn(mockUriInfo); + when(mockUriInfo.getQueryParameters()).thenReturn(map); when(map.getFirst("projectKey")).thenReturn(PROJECT); when(projectManager.getProjectByCurrentKey(PROJECT)).thenReturn(null); diff --git a/pom.xml b/pom.xml index 7aa90742..0f68c9be 100644 --- a/pom.xml +++ b/pom.xml @@ -80,6 +80,7 @@ 3.2.0 1.1.13 + 7.0.0-m40 @@ -117,10 +118,25 @@ - javax.ws.rs - jsr311-api - 1.1.1 - provided + com.atlassian.platform.dependencies + platform-public-api + ${platform.version} + pom + import + + + com.atlassian.platform.dependencies + platform-test-resources + ${platform.version} + pom + import + + + com.atlassian.platform.dependencies + platform-internal-api + ${platform.version} + pom + import com.github.seratch @@ -291,39 +307,6 @@ test - - com.atlassian.plugins.rest - atlassian-rest-common - ${rest.version} - - - fugue - com.atlassian.fugue - - - jackson-core-asl - org.codehaus.jackson - - - jackson-jaxrs - org.codehaus.jackson - - - jackson-mapper-asl - org.codehaus.jackson - - - jackson-xc - org.codehaus.jackson - - - provided - - - com.atlassian.plugins.rest - atlassian-rest-module - ${rest.version} - com.atlassian.plugins atlassian-plugins-core @@ -490,20 +473,6 @@ ${okhttp.version} test - - - - org.codehaus.jackson - jackson-core-asl - 1.9.1 - provided - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.1 - provided - diff --git a/slack-server-integration-common/pom.xml b/slack-server-integration-common/pom.xml index 6da4dd6d..224cf46f 100644 --- a/slack-server-integration-common/pom.xml +++ b/slack-server-integration-common/pom.xml @@ -12,14 +12,19 @@ Provides resources and functionality for linking Atlassian products with slack. - - org.codehaus.jackson - jackson-core-asl + com.fasterxml.jackson.core + jackson-annotations + provided + + + com.fasterxml.jackson.core + jackson-databind + provided - org.codehaus.jackson - jackson-mapper-asl + com.atlassian.security + atlassian-secure-random @@ -89,8 +94,13 @@ provided - javax.ws.rs - jsr311-api + jakarta.ws.rs + jakarta.ws.rs-api + provided + + + javax.inject + javax.inject provided @@ -140,7 +150,7 @@ com.atlassian.plugins.rest - atlassian-rest-common + atlassian-rest-v2-api provided diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/admin/InstallationCompletionData.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/admin/InstallationCompletionData.java index 9d25ef55..684daace 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/admin/InstallationCompletionData.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/admin/InstallationCompletionData.java @@ -1,6 +1,6 @@ package com.atlassian.plugins.slack.admin; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/ao/AOSlackUser.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/ao/AOSlackUser.java index c0268576..6f56461e 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/ao/AOSlackUser.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/ao/AOSlackUser.java @@ -1,13 +1,13 @@ package com.atlassian.plugins.slack.ao; import com.atlassian.plugins.slack.api.SlackUser; +import com.fasterxml.jackson.annotation.JsonIgnore; import net.java.ao.Preload; import net.java.ao.RawEntity; import net.java.ao.schema.Indexed; import net.java.ao.schema.NotNull; import net.java.ao.schema.PrimaryKey; import net.java.ao.schema.Table; -import org.codehaus.jackson.annotate.JsonIgnore; @Table("AOSLACK_USER") @Preload diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/DelayedSlackMessage.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/DelayedSlackMessage.java index 2cb3f544..8e236bfb 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/DelayedSlackMessage.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/DelayedSlackMessage.java @@ -1,8 +1,8 @@ package com.atlassian.plugins.slack.api; +import com.fasterxml.jackson.annotation.JsonProperty; import com.github.seratch.jslack.api.model.Attachment; import com.github.seratch.jslack.api.model.block.LayoutBlock; -import org.codehaus.jackson.annotate.JsonProperty; import java.util.ArrayList; import java.util.List; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/condition/IsSlackEnabledUrlReadingCondition.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/condition/IsSlackEnabledUrlReadingCondition.java index d83cca99..f650309e 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/condition/IsSlackEnabledUrlReadingCondition.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/condition/IsSlackEnabledUrlReadingCondition.java @@ -2,12 +2,12 @@ import com.atlassian.plugin.PluginParseException; import com.atlassian.plugin.web.Condition; -import com.atlassian.plugin.webresource.condition.SimpleUrlReadingCondition; import com.atlassian.plugins.slack.link.SlackLinkManager; +import com.atlassian.webresource.spi.condition.AbstractBooleanUrlReadingCondition; import java.util.Map; -public class IsSlackEnabledUrlReadingCondition extends SimpleUrlReadingCondition implements Condition { +public class IsSlackEnabledUrlReadingCondition extends AbstractBooleanUrlReadingCondition implements Condition { private static final String SLACK_ENABLED_PARAM = "slack-enabled"; private final SlackLinkManager slackLinkManager; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonService.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonService.java index ef2bac26..b9b52d60 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonService.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonService.java @@ -2,8 +2,8 @@ import com.atlassian.annotations.VisibleForTesting; import com.atlassian.json.marshal.Jsonable; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.ObjectMapper; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.stereotype.Component; import java.util.function.Supplier; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/notification/NotificationType.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/notification/NotificationType.java index baf29528..a601c4b5 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/notification/NotificationType.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/notification/NotificationType.java @@ -2,10 +2,10 @@ import com.atlassian.plugins.slack.api.descriptor.SlackNotificationDescriptor; import com.atlassian.sal.api.message.I18nResolver; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; import java.util.Optional; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppHomeOpenedSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppHomeOpenedSlackEvent.java index da0ed759..5a9a6cd6 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppHomeOpenedSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppHomeOpenedSlackEvent.java @@ -1,10 +1,10 @@ package com.atlassian.plugins.slack.api.webhooks; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/app_home_opened diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppUninstalledSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppUninstalledSlackEvent.java index 70065d5c..ebc059f4 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppUninstalledSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/AppUninstalledSlackEvent.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/app_uninstalled diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/BaseChannelEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/BaseChannelEvent.java index c46968d7..762a9524 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/BaseChannelEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/BaseChannelEvent.java @@ -1,7 +1,7 @@ package com.atlassian.plugins.slack.api.webhooks; +import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.ObjectUtils; -import org.codehaus.jackson.annotate.JsonProperty; public class BaseChannelEvent implements SlackEventHolder { private SlackEvent slackEvent; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelArchiveSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelArchiveSlackEvent.java index ba6d7c56..ecea8152 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelArchiveSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelArchiveSlackEvent.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/channel_archive diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelDeletedSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelDeletedSlackEvent.java index 2c681c71..6d9d1689 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelDeletedSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelDeletedSlackEvent.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/channel_archive diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelUnarchiveSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelUnarchiveSlackEvent.java index a08ba7ca..b0044f90 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelUnarchiveSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/ChannelUnarchiveSlackEvent.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/channel_unarchive diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/GenericMessageSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/GenericMessageSlackEvent.java index dfb57087..c099318a 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/GenericMessageSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/GenericMessageSlackEvent.java @@ -1,11 +1,11 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/message diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/LinkSharedSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/LinkSharedSlackEvent.java index 54fc27b5..ffdc5a97 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/LinkSharedSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/LinkSharedSlackEvent.java @@ -1,8 +1,8 @@ package com.atlassian.plugins.slack.api.webhooks; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; import java.util.List; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/MemberJoinedChannelSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/MemberJoinedChannelSlackEvent.java index fc564166..65a554e0 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/MemberJoinedChannelSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/MemberJoinedChannelSlackEvent.java @@ -1,10 +1,10 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/member_joined_channel diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/SlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/SlackEvent.java index db85b290..14ea0744 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/SlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/SlackEvent.java @@ -1,7 +1,7 @@ package com.atlassian.plugins.slack.api.webhooks; import com.atlassian.plugins.slack.api.SlackLink; -import org.codehaus.jackson.annotate.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnore; public class SlackEvent { private String teamId; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/TokensRevokedSlackEvent.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/TokensRevokedSlackEvent.java index fa92b11f..ca94ab2b 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/TokensRevokedSlackEvent.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/TokensRevokedSlackEvent.java @@ -1,13 +1,13 @@ package com.atlassian.plugins.slack.api.webhooks; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; /* https://api.slack.com/events/tokens_revoked diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockKitAction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockKitAction.java index 07146a01..3b9048b7 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockKitAction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockKitAction.java @@ -1,8 +1,8 @@ package com.atlassian.plugins.slack.api.webhooks.action; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; /* { diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockSlackAction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockSlackAction.java index 54705272..abc98cf9 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockSlackAction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/BlockSlackAction.java @@ -1,8 +1,8 @@ package com.atlassian.plugins.slack.api.webhooks.action; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/DialogSubmissionSlackAction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/DialogSubmissionSlackAction.java index 03b2f806..85021f64 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/DialogSubmissionSlackAction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/DialogSubmissionSlackAction.java @@ -1,8 +1,8 @@ package com.atlassian.plugins.slack.api.webhooks.action; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/SlackAction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/SlackAction.java index f38d7907..0b076e4e 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/SlackAction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/webhooks/action/SlackAction.java @@ -1,6 +1,6 @@ package com.atlassian.plugins.slack.api.webhooks.action; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/ConnectionStatusResource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/ConnectionStatusResource.java index 4d7ab2a5..71dd4a1f 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/ConnectionStatusResource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/ConnectionStatusResource.java @@ -16,12 +16,13 @@ import com.atlassian.sal.api.message.I18nResolver; import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonProperty; import com.github.seratch.jslack.api.methods.response.auth.AuthTestResponse; import lombok.RequiredArgsConstructor; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; -import org.codehaus.jackson.annotate.JsonProperty; +import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -48,6 +49,7 @@ public class ConnectionStatusResource { private final SlackLinkAccessManager slackLinkAccessManager; private final SlackSettingService slackSettingService; + @Inject public ConnectionStatusResource(final SlackClientProvider slackClientProvider, final I18nResolver i18nResolver, final SlackLinkManager slackLinkManager, diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackChannelsResource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackChannelsResource.java index 26b4fd01..b09a9c1a 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackChannelsResource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackChannelsResource.java @@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -28,7 +29,7 @@ @ReadOnlyAccessAllowed @Path("channels") -@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RequiredArgsConstructor(onConstructor_ = {@Autowired, @Inject}) public class SlackChannelsResource { private final SlackClientProvider slackClientProvider; private final EventPublisher eventPublisher; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermission.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermission.java new file mode 100644 index 00000000..1c8b5ef7 --- /dev/null +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermission.java @@ -0,0 +1,10 @@ +package com.atlassian.plugins.slack.rest; + +import javax.ws.rs.NameBinding; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@NameBinding +@Retention(RetentionPolicy.RUNTIME) +public @interface SlackLinkAdministerPermission { +} diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermissionResourceFilter.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermissionResourceFilter.java index d66b1de5..d43f8e60 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermissionResourceFilter.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkAdministerPermissionResourceFilter.java @@ -3,23 +3,26 @@ import com.atlassian.plugins.slack.spi.SlackLinkAccessManager; import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; -import com.sun.jersey.spi.container.ContainerRequest; -import com.sun.jersey.spi.container.ContainerRequestFilter; -import com.sun.jersey.spi.container.ContainerResponseFilter; -import com.sun.jersey.spi.container.ResourceFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; +import javax.inject.Inject; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.ext.Provider; /** * Determines whether the user has permission to administer Slack links. */ @Provider -public class SlackLinkAdministerPermissionResourceFilter implements ResourceFilter, ContainerRequestFilter { +@Component +@SlackLinkAdministerPermission +public class SlackLinkAdministerPermissionResourceFilter implements ContainerRequestFilter { private final UserManager userManager; private final SlackLinkAccessManager slackLinkAccessManager; + @Inject @Autowired public SlackLinkAdministerPermissionResourceFilter( @Qualifier("salUserManager") final UserManager userManager, @@ -29,26 +32,14 @@ public SlackLinkAdministerPermissionResourceFilter( } @Override - public ContainerRequest filter(final ContainerRequest containerRequest) { - if (hasAccess(containerRequest)) { - return containerRequest; + public void filter(final ContainerRequestContext containerRequest) { + if (!hasAccess(containerRequest)) { + throw new SecurityException("User must be an Admin to configure this plugin."); } - - throw new SecurityException("User must be an Admin to configure this plugin."); } - private boolean hasAccess(final ContainerRequest containerRequest) { + private boolean hasAccess(final ContainerRequestContext containerRequest) { UserProfile remoteUser = userManager.getRemoteUser(); return slackLinkAccessManager.hasAccess(remoteUser, containerRequest); } - - @Override - public ContainerRequestFilter getRequestFilter() { - return this; - } - - @Override - public ContainerResponseFilter getResponseFilter() { - return null; - } } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkResource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkResource.java index 507d6414..0d0ea9f2 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkResource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkResource.java @@ -8,13 +8,13 @@ import com.atlassian.plugins.slack.rest.model.GetWorkspacesResponse; import com.atlassian.plugins.slack.rest.model.LimitedSlackLinkDto; import com.atlassian.sal.api.message.I18nResolver; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableMap; -import com.sun.jersey.spi.container.ResourceFilters; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -39,6 +39,7 @@ public class SlackLinkResource { private final I18nResolver i18nResolver; private final SlackClientProvider slackClientProvider; + @Inject @Autowired public SlackLinkResource(final SlackConnectionService slackConnectionService, final SlackLinkManager slackLinkManager, @@ -51,7 +52,7 @@ public SlackLinkResource(final SlackConnectionService slackConnectionService, } private String nonNullString(final JsonNode node) { - String textValue = node.getTextValue(); + String textValue = node.asText(); if (textValue == null || textValue.isEmpty()) { throw new IllegalArgumentException("Required field has no value"); } @@ -72,7 +73,7 @@ public Response getLinkedTeams() { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ResourceFilters(SlackLinkAdministerPermissionResourceFilter.class) + @SlackLinkAdministerPermission public Response createTeam(final String body) { return updateTeam(null, body); } @@ -81,7 +82,7 @@ public Response createTeam(final String body) { @Path("/{teamId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ResourceFilters(SlackLinkAdministerPermissionResourceFilter.class) + @SlackLinkAdministerPermission public Response updateTeam(@PathParam("teamId") final String teamId, final String body) { final SlackLinkDto dto = new SlackLinkDto(); boolean isCustom = false; @@ -147,7 +148,7 @@ public Response updateTeam(@PathParam("teamId") final String teamId, final Strin @Path("/{teamId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ResourceFilters(SlackLinkAdministerPermissionResourceFilter.class) + @SlackLinkAdministerPermission public Response deleteTeam(@PathParam("teamId") final String teamId) { return slackConnectionService.disconnectTeam(teamId).fold( e -> Response.status(BAD_REQUEST).build(), @@ -158,7 +159,7 @@ public Response deleteTeam(@PathParam("teamId") final String teamId) { @Path("/can-reach-slack") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ResourceFilters(SlackLinkAdministerPermissionResourceFilter.class) + @SlackLinkAdministerPermission public Response validateSlackReachability() { return slackClientProvider.withoutCredentials().testApi().fold( e -> Response diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkUninstallPermissionResourceFilter.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkUninstallPermissionResourceFilter.java index b851ddef..bb24d65a 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkUninstallPermissionResourceFilter.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackLinkUninstallPermissionResourceFilter.java @@ -2,12 +2,11 @@ import com.atlassian.plugins.slack.spi.SlackLinkAccessManager; import com.atlassian.sal.api.user.UserManager; -import com.sun.jersey.spi.container.ContainerRequest; -import com.sun.jersey.spi.container.ContainerRequestFilter; -import com.sun.jersey.spi.container.ContainerResponseFilter; -import com.sun.jersey.spi.container.ResourceFilter; import org.springframework.beans.factory.annotation.Qualifier; +import javax.inject.Inject; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import javax.ws.rs.ext.Provider; @@ -17,13 +16,14 @@ * If not link id is provided, the default link is used. */ @Provider -public class SlackLinkUninstallPermissionResourceFilter implements ResourceFilter, ContainerRequestFilter { +public class SlackLinkUninstallPermissionResourceFilter implements ContainerRequestFilter { @Context private UriInfo uriInfo; private final UserManager userManager; private final SlackLinkAccessManager slackLinkAccessManager; + @Inject public SlackLinkUninstallPermissionResourceFilter(@Qualifier("salUserManager") final UserManager userManager, final SlackLinkAccessManager slackLinkAccessManager) { this.userManager = userManager; @@ -31,25 +31,13 @@ public SlackLinkUninstallPermissionResourceFilter(@Qualifier("salUserManager") f } @Override - public ContainerRequest filter(final ContainerRequest containerRequest) { + public void filter(final ContainerRequestContext containerRequest) { if (!hasAccess(containerRequest)) { throw new SecurityException("User must be an Administrator to uninstall this plugin."); } - - return containerRequest; } - private boolean hasAccess(final ContainerRequest containerRequest) { + private boolean hasAccess(final ContainerRequestContext containerRequest) { return slackLinkAccessManager.hasAccess(userManager.getRemoteUser(), containerRequest); } - - @Override - public ContainerRequestFilter getRequestFilter() { - return this; - } - - @Override - public ContainerResponseFilter getResponseFilter() { - return null; - } } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackOAuth2Resource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackOAuth2Resource.java index 986431f6..7eaab174 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackOAuth2Resource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackOAuth2Resource.java @@ -15,11 +15,11 @@ import com.atlassian.sal.api.message.I18nResolver; import com.atlassian.sal.api.user.UserKey; import com.atlassian.sal.api.user.UserManager; -import com.sun.jersey.spi.container.ResourceFilters; import io.atlassian.fugue.Either; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Qualifier; +import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; @@ -47,6 +47,7 @@ public class SlackOAuth2Resource { private final I18nResolver i18nResolver; private final SlackConnectionService slackConnectionService; + @Inject public SlackOAuth2Resource(final Oauth2AuthoriseService oauth2AuthoriseService, final XsrfTokenGenerator tokenGenerator, final SlackLinkManager slackLinkManager, @@ -62,7 +63,7 @@ public SlackOAuth2Resource(final Oauth2AuthoriseService oauth2AuthoriseService, } @GET - @ResourceFilters(SlackLinkAdministerPermissionResourceFilter.class) + @SlackLinkAdministerPermission public Response installViaOauth2(@Context final HttpServletRequest servletRequest, @Context final HttpServletResponse servletResponse, @QueryParam("code") final String code, diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSettingsRedirectResource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSettingsRedirectResource.java index b9f0da57..93877daa 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSettingsRedirectResource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSettingsRedirectResource.java @@ -1,11 +1,12 @@ package com.atlassian.plugins.slack.rest; -import com.atlassian.plugins.rest.common.security.AnonymousAllowed; +import com.atlassian.plugins.rest.api.security.annotation.AnonymousSiteAccess; import com.atlassian.sal.api.ApplicationProperties; import com.atlassian.sal.api.UrlMode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; @@ -14,10 +15,11 @@ import static javax.ws.rs.core.Response.Status.MOVED_PERMANENTLY; @Path("/settings") -@AnonymousAllowed +@AnonymousSiteAccess public class SlackSettingsRedirectResource { private final ApplicationProperties applicationProperties; + @Inject @Autowired public SlackSettingsRedirectResource(@Qualifier("salApplicationProperties") final ApplicationProperties applicationProperties) { this.applicationProperties = applicationProperties; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifying.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifying.java new file mode 100644 index 00000000..00f85df5 --- /dev/null +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifying.java @@ -0,0 +1,10 @@ +package com.atlassian.plugins.slack.rest; + +import javax.ws.rs.NameBinding; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@NameBinding +@Retention(RetentionPolicy.RUNTIME) +public @interface SlackSignatureVerifying { +} diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifyingFilter.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifyingFilter.java index 59e83ea4..06035044 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifyingFilter.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackSignatureVerifyingFilter.java @@ -8,19 +8,18 @@ import com.atlassian.plugins.slack.api.events.SigningSecretVerificationFailedEvent.Cause; import com.atlassian.plugins.slack.link.SlackLinkManager; import com.atlassian.plugins.slack.settings.SlackSettingService; -import com.sun.jersey.spi.container.ContainerRequest; -import com.sun.jersey.spi.container.ContainerRequestFilter; -import com.sun.jersey.spi.container.ContainerResponseFilter; -import com.sun.jersey.spi.container.ResourceFilter; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import javax.inject.Inject; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.ext.Provider; @@ -42,7 +41,8 @@ @Slf4j @Provider -public class SlackSignatureVerifyingFilter implements ContainerRequestFilter, ResourceFilter { +@SlackSignatureVerifying +public class SlackSignatureVerifyingFilter implements ContainerRequestFilter { public static final String TEAM_ID = "team_id"; public static final String SLACK_ACTION_PAYLOAD = "payload"; public static final int MAX_REQUEST_DELAY_MINUTES = 6; @@ -57,6 +57,7 @@ public class SlackSignatureVerifyingFilter implements ContainerRequestFilter, Re private final boolean skipVerification; + @Inject public SlackSignatureVerifyingFilter(final SlackLinkManager slackLinkManager, final EventPublisher eventPublisher, final RequestHolder requestHolder, @@ -71,16 +72,16 @@ public SlackSignatureVerifyingFilter(final SlackLinkManager slackLinkManager, } @Override - public ContainerRequest filter(final ContainerRequest request) { + public void filter(final ContainerRequestContext request) { if (skipVerification) { - return request; + return; } - String contentTypeStr = request.getHeaderValue(HttpHeaders.CONTENT_TYPE); + String contentTypeStr = request.getHeaderString(HttpHeaders.CONTENT_TYPE); MediaType contentType = parseContentType(contentTypeStr); - String requestTimestamp = request.getHeaderValue(X_SLACK_REQUEST_TIMESTAMP); - String actualSignature = request.getHeaderValue(X_SLACK_SIGNATURE); + String requestTimestamp = request.getHeaderString(X_SLACK_REQUEST_TIMESTAMP); + String actualSignature = request.getHeaderString(X_SLACK_SIGNATURE); validateTimestamp(requestTimestamp); // fail verification immediately if cached request not found @@ -94,7 +95,7 @@ public ContainerRequest filter(final ContainerRequest request) { String requestPayload = new String(cachedRequest.getBody(), StandardCharsets.UTF_8); Optional payloadJson = parseJson(requestPayload); Optional teamId = payloadJson - .map(node -> node.path(TEAM_ID).getTextValue()) + .map(node -> node.path(TEAM_ID).asText()) .filter(StringUtils::isNotBlank); // it's dummy team from integration tests; skip verification for it @@ -102,7 +103,7 @@ public ContainerRequest filter(final ContainerRequest request) { // do not check signature on 'url_verification' request since it is triggered during // the team connection process; so database may not have corresponding SlackLink yet - Optional type = payloadJson.map(node -> node.path(SlackWebHookResource.EVENT_TYPE).getTextValue()); + Optional type = payloadJson.map(node -> node.path(SlackWebHookResource.EVENT_TYPE).asText()); boolean isInitialRequest = type.map(SlackWebHookResource.TYPE_URL_VERIFICATION::equals).orElse(false); if (!isInitialRequest && !isDummyTeam) { if (teamId.isPresent()) { @@ -132,8 +133,6 @@ public ContainerRequest filter(final ContainerRequest request) { if (!slackSettingService.isInstancePublic()) { slackSettingService.setInstancePublic(true); } - - return request; } private MediaType parseContentType(final String contentTypeStr) { @@ -150,7 +149,7 @@ private Optional getTeamIdFromFormPayload(final Map fo if (!teamId.isPresent()) { Optional payload = getFirst(formParams, SLACK_ACTION_PAYLOAD); teamId = payload.flatMap(this::parseJson) - .map(node -> node.path("team").path("id").getTextValue()) + .map(node -> node.path("team").path("id").asText()) .filter(StringUtils::isNotBlank); } return teamId; @@ -246,14 +245,4 @@ private void failVerification(final SecurityException exception, eventPublisher.publish(new SigningSecretVerificationFailedEvent(analyticsContext, cause)); throw exception; } - - @Override - public ContainerRequestFilter getRequestFilter() { - return this; - } - - @Override - public ContainerResponseFilter getResponseFilter() { - return null; - } } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackUsersResource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackUsersResource.java index 9bc5188a..0da3b2b3 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackUsersResource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackUsersResource.java @@ -7,6 +7,7 @@ import com.atlassian.plugins.slack.user.SlackUserService; import com.atlassian.sal.api.user.UserManager; +import javax.inject.Inject; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.PUT; @@ -27,6 +28,7 @@ public class SlackUsersResource { private final SlackUserSettingsService slackUserSettingsService; private final UserManager userManager; + @Inject public SlackUsersResource(final SlackUserService slackUserService, final SlackPluginResourceProvider slackPluginResourceProvider, final SlackUserSettingsService slackUserSettingsService, diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackWebHookResource.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackWebHookResource.java index 8c00d9ec..75a1ff59 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackWebHookResource.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/SlackWebHookResource.java @@ -3,7 +3,7 @@ import com.atlassian.annotations.security.XsrfProtectionExcluded; import com.atlassian.confluence.compat.api.service.accessmode.ReadOnlyAccessAllowed; import com.atlassian.event.api.EventPublisher; -import com.atlassian.plugins.rest.common.security.AnonymousAllowed; +import com.atlassian.plugins.rest.api.security.annotation.AnonymousSiteAccess; import com.atlassian.plugins.slack.analytics.AnalyticsContextProvider; import com.atlassian.plugins.slack.api.SlackLink; import com.atlassian.plugins.slack.api.events.SlackActionAnalyticEvent; @@ -29,15 +29,15 @@ import com.atlassian.plugins.slack.link.SlackLinkManager; import com.atlassian.plugins.slack.rest.model.SlackWebHookPayload; import com.atlassian.plugins.slack.util.AsyncExecutor; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableMap; -import com.sun.jersey.spi.container.ResourceFilters; import lombok.RequiredArgsConstructor; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.FormParam; @@ -61,7 +61,7 @@ */ @ReadOnlyAccessAllowed @Path("/") -@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RequiredArgsConstructor(onConstructor_ = {@Autowired, @Inject}) public class SlackWebHookResource { public static final String EVENT_TYPE = "type"; public static final String TYPE_URL_VERIFICATION = "url_verification"; @@ -98,12 +98,12 @@ public class SlackWebHookResource { @POST @Path("/event") @Consumes(MediaType.APPLICATION_JSON) - @AnonymousAllowed - @ResourceFilters(SlackSignatureVerifyingFilter.class) + @AnonymousSiteAccess + @SlackSignatureVerifying public Response webEvent(@Context final HttpServletRequest request, final JsonNode eventPayload) { - if (TYPE_URL_VERIFICATION.equals(eventPayload.path(EVENT_TYPE).getTextValue())) { + if (TYPE_URL_VERIFICATION.equals(eventPayload.path(EVENT_TYPE).asText())) { return Response - .ok(eventPayload.path("challenge").getTextValue()) + .ok(eventPayload.path("challenge").asText()) .type(MediaType.TEXT_PLAIN) .build(); } @@ -167,9 +167,9 @@ public Response webEvent(@Context final HttpServletRequest request, final JsonNo @Path("/command") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) - @AnonymousAllowed + @AnonymousSiteAccess @XsrfProtectionExcluded - @ResourceFilters(SlackSignatureVerifyingFilter.class) + @SlackSignatureVerifying public Response slashCommand( @HeaderParam("X-Slack-Signature") final String signingSecret, @FormParam("token") String verificationToken, @@ -223,9 +223,9 @@ public Response slashCommand( @Path("/action") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) - @AnonymousAllowed + @AnonymousSiteAccess @XsrfProtectionExcluded - @ResourceFilters(SlackSignatureVerifyingFilter.class) + @SlackSignatureVerifying public Response action(@FormParam("payload") String payload) { asyncExecutor.run(() -> { log.debug("Received action {}", payload); diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/GetWorkspacesResponse.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/GetWorkspacesResponse.java index d0388f6a..e85c848c 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/GetWorkspacesResponse.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/GetWorkspacesResponse.java @@ -1,12 +1,12 @@ package com.atlassian.plugins.slack.rest.model; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @SuppressWarnings("unused") @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/LimitedSlackLinkDto.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/LimitedSlackLinkDto.java index 1f1674d8..7b17edb0 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/LimitedSlackLinkDto.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/LimitedSlackLinkDto.java @@ -1,11 +1,11 @@ package com.atlassian.plugins.slack.rest.model; import com.atlassian.plugins.slack.api.SlackLink; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Value; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @SuppressWarnings("unused") @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/OauthRequestData.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/OauthRequestData.java index da421025..ee9e9f61 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/OauthRequestData.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/OauthRequestData.java @@ -1,11 +1,11 @@ package com.atlassian.plugins.slack.rest.model; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = ANY) diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackChannelDTO.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackChannelDTO.java index 0b6f65bd..cb67561d 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackChannelDTO.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackChannelDTO.java @@ -1,13 +1,13 @@ package com.atlassian.plugins.slack.rest.model; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; /** * This class contains Slack channel information diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackUserDto.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackUserDto.java index 1be0cd62..9798ffa6 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackUserDto.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackUserDto.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.rest.model; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import lombok.Value; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @JsonAutoDetect(getterVisibility = PUBLIC_ONLY) @Value diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackWebHookPayload.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackWebHookPayload.java index 88bf2eaa..4a22bde4 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackWebHookPayload.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/model/SlackWebHookPayload.java @@ -1,12 +1,12 @@ package com.atlassian.plugins.slack.rest.model; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = ANY) @@ -57,6 +57,6 @@ public int getEventTime() { } public String getType() { - return event.path("type").getTextValue(); + return event.path("type").asText(); } } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/SimpleJsonSerializeFunction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/SimpleJsonSerializeFunction.java index 3a45cd78..9c0e72d8 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/SimpleJsonSerializeFunction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/SimpleJsonSerializeFunction.java @@ -1,8 +1,8 @@ package com.atlassian.plugins.slack.soy; import com.atlassian.soy.renderer.SoyServerFunction; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableSet; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/SlackLinkAccessManager.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/SlackLinkAccessManager.java index 89fd6ef7..495dd319 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/SlackLinkAccessManager.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/SlackLinkAccessManager.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.spi; import com.atlassian.sal.api.user.UserProfile; -import com.sun.jersey.spi.container.ContainerRequest; import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.container.ContainerRequestContext; /** * Determines if a user has access to the Slack link. @@ -17,7 +17,7 @@ public interface SlackLinkAccessManager { * @param request - the request * @return true if the given user has access to add a link given the request. */ - boolean hasAccess(UserProfile userProfile, ContainerRequest request); + boolean hasAccess(UserProfile userProfile, ContainerRequestContext request); /** * Returns true if the given user has access to add a link diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/impl/AbstractSlackLinkAccessManager.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/impl/AbstractSlackLinkAccessManager.java index 3226c0e6..b4d90060 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/impl/AbstractSlackLinkAccessManager.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/spi/impl/AbstractSlackLinkAccessManager.java @@ -4,9 +4,9 @@ import com.atlassian.sal.api.user.UserKey; import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; -import com.sun.jersey.spi.container.ContainerRequest; import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.container.ContainerRequestContext; public abstract class AbstractSlackLinkAccessManager implements SlackLinkAccessManager { @@ -17,7 +17,7 @@ public AbstractSlackLinkAccessManager(final UserManager userManager) { } @Override - public boolean hasAccess(UserProfile userProfile, ContainerRequest request) { + public boolean hasAccess(UserProfile userProfile, ContainerRequestContext request) { return hasAccess(userProfile); } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ErrorResponse.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ErrorResponse.java index 32f05284..77bd7d2d 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ErrorResponse.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ErrorResponse.java @@ -1,18 +1,18 @@ package com.atlassian.plugins.slack.util; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.github.seratch.jslack.api.methods.SlackApiException; import com.github.seratch.jslack.api.methods.SlackApiResponse; import com.google.common.base.Throwables; import io.atlassian.fugue.Either; import io.atlassian.fugue.Eithers; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; import java.net.ConnectException; import java.net.SocketTimeoutException; -import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = ANY) diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ResponseMapper.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ResponseMapper.java index 03a94d4c..c5dc7a37 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ResponseMapper.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/util/ResponseMapper.java @@ -1,10 +1,10 @@ package com.atlassian.plugins.slack.util; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.github.seratch.jslack.api.methods.SlackApiResponse; import io.atlassian.fugue.Either; import okhttp3.Response; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.PropertyNamingStrategy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,7 +15,7 @@ public class ResponseMapper { private static final Logger log = LoggerFactory.getLogger(ResponseMapper.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() - .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); + .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); private ResponseMapper() { } diff --git a/slack-server-integration-common/src/test/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonServiceTest.java b/slack-server-integration-common/src/test/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonServiceTest.java index 89344a9b..0a56fa09 100644 --- a/slack-server-integration-common/src/test/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonServiceTest.java +++ b/slack-server-integration-common/src/test/java/com/atlassian/plugins/slack/api/json/DefaultJsonableJacksonServiceTest.java @@ -1,9 +1,9 @@ package com.atlassian.plugins.slack.api.json; import com.atlassian.json.marshal.Jsonable; -import org.codehaus.jackson.JsonFactory; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.ObjectMapper; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Before; import org.junit.Rule; import org.junit.Test; From 03d451a4dd8216d8be47ed3411fe559d575c9e54 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Fri, 17 May 2024 04:08:24 +0300 Subject: [PATCH 02/11] Confluence 9 compatibility --- bin/build/run-confluence-its.sh | 3 + bin/run-confluence.sh | 3 + .../pom.xml | 10 +- .../slack/listener/UnfurlLinkExtractor.java | 39 ++-- .../confluence-7-compat/pom.xml | 28 --- .../Confluence7CompatibilityHandler.java | 33 ---- .../confluence-8-compat/pom.xml | 33 ---- .../confluence-compat-common/pom.xml | 24 --- .../BaseConfluenceCompatibilityHandler.java | 15 -- .../ConfluenceCompatibilityHandler.java | 10 -- .../pom.xml | 123 ++++++++----- .../plugins/slack/ComponentImports.java | 2 +- .../SlackViewSpaceConfigurationAction.java | 3 + .../SlackViewSpaceInstallationAction.java | 13 +- .../listener/SlackMessageEventListener.java | 39 ++-- ...ConfluenceSlackPluginResourceProvider.java | 4 +- .../impl/SpaceAwareSlackRoutesProvider.java | 2 +- .../plugins/slack/util/SearchBuilder.java} | 34 ++-- .../ConfluenceCompatibilityDispatcher.java | 35 ---- .../src/main/resources/atlassian-plugin.xml | 6 +- ...SlackViewSpaceConfigurationActionTest.java | 29 ++- .../SlackViewSpaceInstallationActionTest.java | 20 ++- .../SlackMessageEventListenerTest.java | 16 +- .../ConfluenceSlackLinkAccessManagerTest.java | 14 +- ...luenceSlackPluginResourceProviderTest.java | 4 +- confluence-slack-integration/pom.xml | 17 -- .../jira-8-compat/pom.xml | 5 + .../pom.xml | 10 +- .../slack/service/ComponentImports.java | 2 +- jira-slack-server-integration/pom.xml | 10 +- pom.xml | 167 +----------------- slack-server-integration-common/pom.xml | 38 ++-- .../SlackNotificationContextDescriptor.java | 4 +- .../SlackNotificationDescriptor.java | 4 +- .../routes/DefaultSlackRoutesProvider.java | 3 +- .../rest/DelegatingServletInputStream.java | 40 ++++- .../soy/PluginResourceUrlSlackFunction.java | 6 +- .../slack/soy/WebPanelsSlackFunction.java | 5 +- .../velocity/VelocityPageBuilderService.java | 2 +- .../main/resources/admin/configure-slack.vm | 2 +- .../admin/connect/connect-workspace.vm | 2 +- 41 files changed, 325 insertions(+), 534 deletions(-) delete mode 100644 confluence-slack-integration/confluence-7-compat/pom.xml delete mode 100644 confluence-slack-integration/confluence-7-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence7CompatibilityHandler.java delete mode 100644 confluence-slack-integration/confluence-8-compat/pom.xml delete mode 100644 confluence-slack-integration/confluence-compat-common/pom.xml delete mode 100644 confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/BaseConfluenceCompatibilityHandler.java delete mode 100644 confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityHandler.java rename confluence-slack-integration/{confluence-8-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence8CompatibilityHandler.java => confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/SearchBuilder.java} (68%) delete mode 100644 confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityDispatcher.java diff --git a/bin/build/run-confluence-its.sh b/bin/build/run-confluence-its.sh index 6d9e05eb..15f1c3c7 100755 --- a/bin/build/run-confluence-its.sh +++ b/bin/build/run-confluence-its.sh @@ -8,6 +8,8 @@ if [[ ${XVFB_ENABLE} != false ]] ; then export DISPLAY=:20 fi +# TODO: Remove -Denforcer.skip=true after moving from milestone versions + atlas-mvn --batch-mode verify \ ${VERSION_ARG} \ -Dut.test.skip=true \ @@ -18,5 +20,6 @@ atlas-mvn --batch-mode verify \ -Dfailsafe.rerunFailingTestsCount=${RETRY_COUNT:-2} \ -Dfailsafe.forkedProcessExitTimeoutInSeconds=360 \ -Dfailsafe.exitTimeout=360 \ + -Denforcer.skip=true \ -pl confluence-slack-integration/confluence-slack-server-integration-plugin \ "$@" diff --git a/bin/run-confluence.sh b/bin/run-confluence.sh index b01116b4..82e5f771 100755 --- a/bin/run-confluence.sh +++ b/bin/run-confluence.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash +# TODO: Remove -Denforcer.skip=true after moving from milestone versions + ( cd "$( dirname "${BASH_SOURCE[0]}")/.." ; atlas-mvn confluence:debug \ + -Denforcer.skip=true \ -Datlassian.dev.mode=true \ -Dmaven.test.skip=true \ "$@" \ diff --git a/bitbucket-slack-server-integration-plugin/pom.xml b/bitbucket-slack-server-integration-plugin/pom.xml index 1d3215b8..3daa906b 100644 --- a/bitbucket-slack-server-integration-plugin/pom.xml +++ b/bitbucket-slack-server-integration-plugin/pom.xml @@ -191,11 +191,6 @@ jackson-databind provided - - org.glassfish.jersey.core - jersey-common - 2.42 - com.atlassian.soy soy-template-renderer-api @@ -257,6 +252,11 @@ spring-context provided + + org.springframework + spring-web + provided + commons-codec commons-codec diff --git a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java index 6ceeb23f..ef0dad74 100644 --- a/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java +++ b/bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/listener/UnfurlLinkExtractor.java @@ -23,17 +23,18 @@ import com.atlassian.sal.api.UrlMode; import com.google.common.primitives.Ints; import org.apache.commons.lang3.StringUtils; -import org.glassfish.jersey.uri.UriComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; -import javax.ws.rs.core.MultivaluedMap; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -98,21 +99,15 @@ private Optional findContentFrom(final String url, final Set ded final URI link = URI.create(url); // it should contain only the path after the context path final URI relativeLink = getContentPath(link); - final MultivaluedMap queryParams = UriComponent.decodeQuery(link, true); + final MultiValueMap queryParams = UriComponentsBuilder.fromHttpUrl(decodeValue(url)) + .build().getQueryParams(); try { final Comment comment = tryComment(queryParams).orElse(null); final String commentKey = comment != null ? String.valueOf(comment.getId()) : ""; - final List segments = UriComponent - .decodePath(relativeLink, false) + final List segments = UriComponentsBuilder.fromUri(relativeLink).build().getPathSegments() .stream() - .map(path -> { - try { - return URLDecoder.decode(path.getPath(), "UTF-8"); - } catch (UnsupportedEncodingException e) { - return path.getPath(); - } - }) + .map(this::decodeValue) .collect(Collectors.toList()); final String fragment = StringUtils.defaultString(relativeLink.getFragment()); @@ -183,11 +178,19 @@ private Optional findContentFrom(final String url, final Set ded return Optional.empty(); } + private String decodeValue(String value) { + try { + return URLDecoder.decode(value, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return value; + } + } + /** * /projects/HC/repos/webcore-next/pull-requests/3586/overview?commentId=1223781 * /projects/HC/repos/webcore-next/commits/428cf995f290c9601df043dbb6748bb641bb6b10?commentId=1582891 */ - private Optional tryComment(final MultivaluedMap queryParams) { + private Optional tryComment(final MultiValueMap queryParams) { return queryParams.entrySet().stream() .filter(param -> "commentId".equals(param.getKey())) .map(param -> getCommentById(param.getValue().get(0))) @@ -213,7 +216,7 @@ private Optional getCommentById(final String idStr) { * /projects/PROJECT_1/repos/rep_1/browse/add_file/add_file.txt?at=basic_branching */ private Optional tryBranchOrTag(final Repository repository, - final MultivaluedMap queryParams, + final MultiValueMap queryParams, final List segments) { if (segments.size() == 5 && "browse".equals(segments.get(4))) { return getBranchOrTag(repository, queryParams); @@ -221,7 +224,7 @@ private Optional tryBranchOrTag(final Repository repository, return Optional.empty(); } - private Optional getBranchOrTag(final Repository repository, final MultivaluedMap queryParams) { + private Optional getBranchOrTag(final Repository repository, final MultiValueMap queryParams) { return queryParams.entrySet().stream() .filter(param -> "at".equals(param.getKey())) .map(param -> getBranchOrTag(repository, param.getValue().get(0))) @@ -265,7 +268,7 @@ private Optional tryCommit(final Repository repository, final List findCommit(final Repository repository, final MultivaluedMap queryParams) { + private Optional findCommit(final Repository repository, final MultiValueMap queryParams) { return queryParams.entrySet().stream() .filter(param -> "at".equals(param.getKey())) .map(param -> findCommit(repository, param.getValue().get(0))) @@ -317,7 +320,7 @@ private Optional tryFile(final Repository repository, final Optional commitFromPath, final Optional pullRequest, final List segments, - final MultivaluedMap queryParams, + final MultiValueMap queryParams, final String fragment) { // file in default or custom branch/tag, or in "commit from pr" view if (segments.size() >= 6 && "browse".equals(segments.get(4))) { @@ -343,7 +346,7 @@ private Optional tryFile(final Repository repository, } private Optional parseFileForKnownRef(final Repository repository, - final MultivaluedMap queryParams, + final MultiValueMap queryParams, final String fragment, final String filePath) { Commit commit; diff --git a/confluence-slack-integration/confluence-7-compat/pom.xml b/confluence-slack-integration/confluence-7-compat/pom.xml deleted file mode 100644 index e82acc7b..00000000 --- a/confluence-slack-integration/confluence-7-compat/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - 4.0.0 - - confluence-slack-integration - com.atlassian.plugins - 1.1.13 - - - confluence-7-compat - jar - Confluence Data Center 7 Compatibility Package - - - - com.atlassian.confluence - confluence - ${confluence.7.version} - provided - - - com.atlassian.plugins - confluence-compat-common - - - diff --git a/confluence-slack-integration/confluence-7-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence7CompatibilityHandler.java b/confluence-slack-integration/confluence-7-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence7CompatibilityHandler.java deleted file mode 100644 index a1731d9c..00000000 --- a/confluence-slack-integration/confluence-7-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence7CompatibilityHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.atlassian.confluence.plugins.slack.util.compat; - -import com.atlassian.confluence.search.v2.ContentSearch; -import com.atlassian.confluence.search.v2.ISearch; -import com.atlassian.confluence.search.v2.SearchFilter; -import com.atlassian.confluence.search.v2.query.TextQuery; -import com.atlassian.confluence.search.v2.searchfilter.ArchivedSpacesSearchFilter; -import com.atlassian.confluence.search.v2.searchfilter.ContentPermissionsSearchFilter; -import com.atlassian.confluence.search.v2.searchfilter.SpacePermissionsSearchFilter; -import com.atlassian.confluence.search.v2.sort.RelevanceSort; -import com.atlassian.confluence.user.ConfluenceUser; - -import javax.annotation.Nullable; - -public class Confluence7CompatibilityHandler extends BaseConfluenceCompatibilityHandler - implements ConfluenceCompatibilityHandler { - public static final Confluence7CompatibilityHandler INSTANCE = new Confluence7CompatibilityHandler(); - - private Confluence7CompatibilityHandler() {} - - @Override - public ISearch buildSearch(final String query, @Nullable final ConfluenceUser confluenceUser, final int offset, - final int limit) { - TextQuery textQuery = new TextQuery(query); - SearchFilter filter = ContentPermissionsSearchFilter.getInstance() - .and(new ArchivedSpacesSearchFilter(false, getSpaceManager())) - .and(new SpacePermissionsSearchFilter(null, null)); - RelevanceSort sort = new RelevanceSort(); - ISearch searchConfig = new ContentSearch(textQuery, sort, filter, offset, limit); - - return searchConfig; - } -} diff --git a/confluence-slack-integration/confluence-8-compat/pom.xml b/confluence-slack-integration/confluence-8-compat/pom.xml deleted file mode 100644 index 732ff62e..00000000 --- a/confluence-slack-integration/confluence-8-compat/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - confluence-slack-integration - com.atlassian.plugins - 1.1.13 - - - confluence-8-compat - jar - Confluence Data Center 8 Compatibility Package - - - - com.atlassian.confluence - confluence - 7.20.0 - provided - - - com.atlassian.plugin - atlassian-spring-scanner-annotation - provided - - - com.atlassian.plugins - confluence-compat-common - - - diff --git a/confluence-slack-integration/confluence-compat-common/pom.xml b/confluence-slack-integration/confluence-compat-common/pom.xml deleted file mode 100644 index f0610119..00000000 --- a/confluence-slack-integration/confluence-compat-common/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - confluence-slack-integration - com.atlassian.plugins - 1.1.13 - - - confluence-compat-common - jar - Confluence Data Center Compatibility Common Package - - - - com.atlassian.confluence - confluence - ${confluence.7.version} - provided - - - diff --git a/confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/BaseConfluenceCompatibilityHandler.java b/confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/BaseConfluenceCompatibilityHandler.java deleted file mode 100644 index 825e219b..00000000 --- a/confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/BaseConfluenceCompatibilityHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.atlassian.confluence.plugins.slack.util.compat; - -import com.atlassian.confluence.spaces.SpaceManager; -import com.atlassian.sal.api.component.ComponentLocator; - -public class BaseConfluenceCompatibilityHandler { - private SpaceManager spaceManager; - - protected SpaceManager getSpaceManager() { - if (spaceManager == null) { - spaceManager = ComponentLocator.getComponent(SpaceManager.class); - } - return spaceManager; - } -} diff --git a/confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityHandler.java b/confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityHandler.java deleted file mode 100644 index 6344dc06..00000000 --- a/confluence-slack-integration/confluence-compat-common/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityHandler.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.atlassian.confluence.plugins.slack.util.compat; - -import com.atlassian.confluence.search.v2.ISearch; -import com.atlassian.confluence.user.ConfluenceUser; - -import javax.annotation.Nullable; - -public interface ConfluenceCompatibilityHandler { - ISearch buildSearch(String query, @Nullable ConfluenceUser confluenceUser, int offset, int limit); -} diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml index efb64bff..c54e3ef7 100755 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml @@ -22,10 +22,10 @@ ${project.basedir}/.. - 7.10.0 + 9.0.0-m81 - 7.10.0 + 9.0.0-m81 ${confluence.version} 8.6.0 @@ -43,16 +43,6 @@ - - com.atlassian.plugins - confluence-8-compat - ${slack.common.version} - - - com.atlassian.plugins - confluence-7-compat - ${slack.common.version} - @@ -65,6 +55,33 @@ lombok provided + + org.hibernate + hibernate-core + 5.6.15.Final + + + javax.persistence + javax.persistence-api + 2.2 + + + commons-beanutils + commons-beanutils + 1.9.4 + + + commons-collections + commons-collections + + + + + opensymphony + xwork + 1.0.3.6 + + @@ -72,20 +89,6 @@ confluence ${confluence.api.version} provided - - - daisydiff - org.outerj.daisy - - - jackson-mapper-asl - org.codehaus.jackson - - - jackson-core-asl - org.codehaus.jackson - - com.atlassian.analytics @@ -121,19 +124,25 @@ jackson-databind provided - - org.glassfish.jersey.core - jersey-common - 2.42 - commons-codec commons-codec provided - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api + provided + + + javax.inject + javax.inject + 1 + provided + + + jakarta.ws.rs + jakarta.ws.rs-api provided @@ -166,6 +175,11 @@ atlassian-rest-v2-api provided + + io.atlassian.fugue + fugue + provided + @@ -220,10 +234,17 @@ atlassian-test-categories test + + org.glassfish.jersey.core + jersey-common + 2.42 + test + com.atlassian.plugin atlassian-spring-scanner-annotation + provided @@ -241,7 +262,7 @@ com.atlassian.confluence confluence-webdriver-pageobjects - 11.4.5 + 11.5.2 test @@ -252,6 +273,22 @@ junit-dep junit + + javax.ws.rs + jsr311-api + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-core + + + com.atlassian.plugins + atlassian-plugins-api + @@ -262,7 +299,6 @@ org.slf4j slf4j-simple - ${slf4j.version} test @@ -337,13 +373,13 @@ com.atlassian.html.encode, com.atlassian.json.marshal, com.atlassian.plugin, + com.atlassian.plugin.module, + com.atlassian.plugin.elements, com.atlassian.plugin.osgi.factory, + com.atlassian.plugin.osgi.module, com.atlassian.plugin.web, - com.atlassian.plugin.webresource, - com.atlassian.plugin.webresource.condition, - com.atlassian.plugin.webresource.transformer, - com.atlassian.plugin.webresource.url, com.atlassian.plugin.servlet, + com.atlassian.plugins.rest.api*, com.atlassian.sal.api, com.atlassian.sal.api.executor, com.atlassian.sal.api.lifecycle, @@ -357,7 +393,7 @@ com.atlassian.templaterenderer, com.atlassian.util.concurrent, com.atlassian.webresource.api, - com.atlassian.webresource.api.prebake, + com.atlassian.webresource.spi, com.google.common.base, com.google.common.collect, @@ -369,12 +405,11 @@ javax.security.auth.x500, javax.servlet, javax.servlet.http, - javax.ws.rs, - javax.ws.rs.core, - javax.ws.rs.ext, + javax.ws.rs*;version="[2.0.0,3.0.0)", javax.xml.bind.annotation, javax.xml.stream, javax.xml.transform, + javax.persistence, org.apache.commons.lang3, org.apache.commons.lang3.text, org.apache.commons.lang3.tuple, @@ -483,7 +518,7 @@ com.atlassian.plugin atlassian-spring-scanner-maven-plugin - ${atlassian.spring.scanner.version} + 5.0.0 diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/ComponentImports.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/ComponentImports.java index a99d4192..5e42af5e 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/ComponentImports.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/ComponentImports.java @@ -25,7 +25,6 @@ import com.atlassian.plugin.module.ModuleFactory; import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport; import com.atlassian.plugin.web.WebInterfaceManager; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.sal.api.ApplicationProperties; import com.atlassian.sal.api.auth.LoginUriProvider; import com.atlassian.sal.api.executor.ThreadLocalDelegateExecutorFactory; @@ -38,6 +37,7 @@ import com.atlassian.sal.api.web.context.HttpContext; import com.atlassian.soy.renderer.SoyTemplateRenderer; import com.atlassian.templaterenderer.TemplateRenderer; +import com.atlassian.webresource.api.WebResourceUrlProvider; import com.atlassian.webresource.api.assembler.PageBuilderService; @SuppressWarnings("unused") diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceConfigurationAction.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceConfigurationAction.java index bf9b80df..fa123287 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceConfigurationAction.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceConfigurationAction.java @@ -16,6 +16,7 @@ import com.atlassian.plugins.slack.link.SlackLinkManager; import com.atlassian.plugins.slack.spi.SlackRoutesProviderFactory; import com.atlassian.plugins.slack.user.SlackUserManager; +import com.atlassian.xwork.PermittedMethods; import com.github.seratch.jslack.api.model.User; import com.google.common.collect.ImmutableMap; import com.opensymphony.xwork.Action; @@ -23,6 +24,7 @@ import java.util.List; +import static com.atlassian.xwork.HttpMethod.GET; import static com.google.common.collect.Lists.newArrayList; @RequiredArgsConstructor @@ -42,6 +44,7 @@ public class SlackViewSpaceConfigurationAction extends AbstractSpaceAdminAction private SlackRoutesProvider routesProvider; private String teamId; + @PermittedMethods(GET) @Override public String execute() { List links = slackLinkManager.getLinks(); diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceInstallationAction.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceInstallationAction.java index a8a4e2f0..9fdb4f6b 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceInstallationAction.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/actions/SlackViewSpaceInstallationAction.java @@ -1,26 +1,31 @@ package com.atlassian.confluence.plugins.slack.spacetochannel.actions; import com.atlassian.confluence.spaces.actions.AbstractSpaceAdminAction; +import com.atlassian.xwork.PermittedMethods; import com.opensymphony.xwork.Action; +import javax.servlet.http.HttpSession; import java.util.Map; import static com.atlassian.confluence.plugins.slack.spi.impl.ConfluenceConfigurationRedirectionManager.FROM_SPACE_ATTRIBUTE_KEY; import static com.atlassian.confluence.plugins.slack.spi.impl.ConfluenceConfigurationRedirectionManager.SPACE_ATTRIBUTE_KEY; +import static com.atlassian.xwork.HttpMethod.GET; public class SlackViewSpaceInstallationAction extends AbstractSpaceAdminAction { static final String CONTEXT_ATTRIBUTE_LABEL = "context"; + @PermittedMethods(GET) @Override public String execute() { + HttpSession session = getCurrentRequest().getSession(); @SuppressWarnings("unchecked") - final Map contextFromSession = (Map) getCurrentSession().getAttribute(CONTEXT_ATTRIBUTE_LABEL); + final Map contextFromSession = (Map) session.getAttribute(CONTEXT_ATTRIBUTE_LABEL); if (contextFromSession != null) { - getCurrentSession().removeAttribute(CONTEXT_ATTRIBUTE_LABEL); + session.removeAttribute(CONTEXT_ATTRIBUTE_LABEL); } - getCurrentSession().setAttribute(FROM_SPACE_ATTRIBUTE_KEY, true); - getCurrentSession().setAttribute(SPACE_ATTRIBUTE_KEY, getSpaceKey()); + session.setAttribute(FROM_SPACE_ATTRIBUTE_KEY, true); + session.setAttribute(SPACE_ATTRIBUTE_KEY, getSpaceKey()); return Action.SUCCESS; } diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java index dcd80417..ca911aa5 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spacetochannel/listener/SlackMessageEventListener.java @@ -15,9 +15,8 @@ import com.atlassian.confluence.plugins.slack.spacetochannel.model.PageType; import com.atlassian.confluence.plugins.slack.spacetochannel.model.QuestionType; import com.atlassian.confluence.plugins.slack.util.ConfluenceUserImpersonator; +import com.atlassian.confluence.plugins.slack.util.SearchBuilder; import com.atlassian.confluence.plugins.slack.util.TinyLinkHelper; -import com.atlassian.confluence.plugins.slack.util.compat.ConfluenceCompatibilityDispatcher; -import com.atlassian.confluence.plugins.slack.util.compat.ConfluenceCompatibilityHandler; import com.atlassian.confluence.search.v2.ISearch; import com.atlassian.confluence.search.v2.InvalidSearchException; import com.atlassian.confluence.search.v2.SearchManager; @@ -50,9 +49,9 @@ import io.atlassian.fugue.Pair; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.glassfish.jersey.uri.UriComponent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.web.util.UriComponentsBuilder; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -95,7 +94,7 @@ public class SlackMessageEventListener extends AutoSubscribingEventListener { private final SearchManager searchManager; private final AnalyticsContextProvider analyticsContextProvider; private final ConfluenceUserImpersonator confluenceUserImpersonator; - private final ConfluenceCompatibilityDispatcher confluenceCompatibilityDispatcher; + private final SearchBuilder searchBuilder; private final int maxSearchResultsToShow; @@ -113,7 +112,7 @@ public SlackMessageEventListener(final EventPublisher eventPublisher, final SearchManager searchManager, final AnalyticsContextProvider analyticsContextProvider, final ConfluenceUserImpersonator confluenceUserImpersonator, - final ConfluenceCompatibilityDispatcher confluenceCompatibilityDispatcher) { + final SearchBuilder searchBuilder) { super(eventPublisher); this.eventPublisher = eventPublisher; this.attachmentBuilder = attachmentBuilder; @@ -128,7 +127,7 @@ public SlackMessageEventListener(final EventPublisher eventPublisher, this.searchManager = searchManager; this.analyticsContextProvider = analyticsContextProvider; this.confluenceUserImpersonator = confluenceUserImpersonator; - this.confluenceCompatibilityDispatcher = confluenceCompatibilityDispatcher; + this.searchBuilder = searchBuilder; this.maxSearchResultsToShow = Integer.getInteger("slack.search.max.results", DEFAULT_MAX_SEARCH_RESULT_TO_SHOW); } @@ -330,7 +329,7 @@ private boolean userHasAccessToPage(final SpaceContentEntityObject page, final C private Optional findContentFrom(final String url) { final URI link = URI.create(url); - final Optional byPageId = tryPageId(link); + final Optional byPageId = tryPageId(url); if (byPageId.isPresent()) { return byPageId; } @@ -338,16 +337,9 @@ private Optional findContentFrom(final Strin // it should contain the path after the context path final URI relativeLink = getContentPath(link); try { - final List segments = UriComponent - .decodePath(relativeLink, false) + final List segments = UriComponentsBuilder.fromUri(relativeLink).build().getPathSegments() .stream() - .map(path -> { - try { - return URLDecoder.decode(path.getPath(), StandardCharsets.UTF_8.name()); - } catch (UnsupportedEncodingException e) { - return path.getPath(); - } - }) + .map(this::decodeValue) .collect(Collectors.toList()); final Optional byTinyUrl = tryTinyUrl(segments); if (byTinyUrl.isPresent()) { @@ -371,6 +363,14 @@ private Optional findContentFrom(final Strin return Optional.empty(); } + private String decodeValue(String value) { + try { + return URLDecoder.decode(value, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return value; + } + } + /** * http://localhost:1990/confluence/display/TEAM/2019/02/06/Simple+blog */ @@ -428,8 +428,8 @@ private Optional tryTinyUrl(final List segments) { * Pages and blogs are the same: * http://localhost:1990/confluence/pages/viewpage.action?pageId=851986 */ - private Optional tryPageId(final URI link) { - return UriComponent.decodeQuery(link, true).entrySet().stream() + private Optional tryPageId(final String url) { + return UriComponentsBuilder.fromHttpUrl(decodeValue(url)).build().getQueryParams().entrySet().stream() .filter(param -> "pageId".equals(param.getKey())) .map(param -> getContentById(param.getValue().get(0))) .filter(Optional::isPresent) @@ -550,8 +550,7 @@ private List searchAtMostThatManyPagesOrBlogs(final St @Nullable final ConfluenceUser confluenceUser, final int pagesOrBlogsToSearch) { List pagesOrBlogs = Collections.emptyList(); - ConfluenceCompatibilityHandler compatibilityHandler = confluenceCompatibilityDispatcher.getHandler(); - ISearch searchConfig = compatibilityHandler.buildSearch(query, confluenceUser, 0, pagesOrBlogsToSearch); + ISearch searchConfig = searchBuilder.buildSearch(query, confluenceUser, 0, pagesOrBlogsToSearch); try { SearchResults searchResults = searchManager.search(searchConfig); diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackPluginResourceProvider.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackPluginResourceProvider.java index 27977765..44b9e2e3 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackPluginResourceProvider.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/ConfluenceSlackPluginResourceProvider.java @@ -1,9 +1,9 @@ package com.atlassian.confluence.plugins.slack.spi.impl; import com.atlassian.confluence.plugins.slack.spacetochannel.notifications.ConfluencePersonalNotificationTypes; -import com.atlassian.plugin.webresource.UrlMode; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.plugins.slack.spi.SlackPluginResourceProvider; +import com.atlassian.webresource.api.UrlMode; +import com.atlassian.webresource.api.WebResourceUrlProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/SpaceAwareSlackRoutesProvider.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/SpaceAwareSlackRoutesProvider.java index bd9312d7..3c0ca1b6 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/SpaceAwareSlackRoutesProvider.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/spi/impl/SpaceAwareSlackRoutesProvider.java @@ -33,6 +33,6 @@ public URI baseUrl() { public URI getAdminConfigurationPage() { return UriBuilder.fromPath(SLACK_SPACE_ADMIN) .queryParam("key", spaceKey) - .build(baseUrl()); + .build(new Object[]{baseUrl()}, false); } } diff --git a/confluence-slack-integration/confluence-8-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence8CompatibilityHandler.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/SearchBuilder.java similarity index 68% rename from confluence-slack-integration/confluence-8-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence8CompatibilityHandler.java rename to confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/SearchBuilder.java index b3d6aaab..e1d6c74c 100644 --- a/confluence-slack-integration/confluence-8-compat/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/Confluence8CompatibilityHandler.java +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/SearchBuilder.java @@ -1,4 +1,4 @@ -package com.atlassian.confluence.plugins.slack.util.compat; +package com.atlassian.confluence.plugins.slack.util; import com.atlassian.confluence.search.v2.ContentSearch; import com.atlassian.confluence.search.v2.ISearch; @@ -9,26 +9,25 @@ import com.atlassian.confluence.search.v2.query.ContentPermissionsQuery; import com.atlassian.confluence.search.v2.query.TextQuery; import com.atlassian.confluence.search.v2.sort.RelevanceSort; +import com.atlassian.confluence.spaces.SpaceManager; import com.atlassian.confluence.user.ConfluenceUser; import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport; import com.atlassian.sal.api.component.ComponentLocator; +import org.springframework.stereotype.Component; import javax.annotation.Nullable; import java.util.HashSet; import java.util.Set; -public class Confluence8CompatibilityHandler extends BaseConfluenceCompatibilityHandler - implements ConfluenceCompatibilityHandler { - public static final Confluence8CompatibilityHandler INSTANCE = new Confluence8CompatibilityHandler(); - - // component is imported here instead of ComponentImports class intentionally because SpacePermissionQueryFactory - // is only available since Confluence 7.17, while ComponentImports are compiled against libraries of older Confluence +@Component +public class SearchBuilder { @ComponentImport private SpacePermissionQueryFactory spacePermissionQueryFactory; + private SpaceManager spaceManager; - private Confluence8CompatibilityHandler() {} + private SearchBuilder() { + } - @Override public ISearch buildSearch(final String query, @Nullable final ConfluenceUser confluenceUser, final int offset, final int limit) { Set searchQueries = new HashSet<>(); @@ -42,11 +41,20 @@ public ISearch buildSearch(final String query, @Nullable final ConfluenceUser co .build()); searchQueries.add(getSpacePermissionQueryFactory().create(confluenceUser)); } - SearchQuery searchQuery = BooleanQuery.composeAndQuery(searchQueries); - RelevanceSort sort = new RelevanceSort(); - ISearch searchConfig = new ContentSearch(searchQuery, sort, offset, limit); - return searchConfig; + return ContentSearch.builder() + .query(BooleanQuery.composeAndQuery(searchQueries)) + .sort(new RelevanceSort()) + .startOffset(offset) + .limit(limit) + .build(); + } + + protected SpaceManager getSpaceManager() { + if (spaceManager == null) { + spaceManager = ComponentLocator.getComponent(SpaceManager.class); + } + return spaceManager; } private SpacePermissionQueryFactory getSpacePermissionQueryFactory() { diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityDispatcher.java b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityDispatcher.java deleted file mode 100644 index 445f2fd5..00000000 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/java/com/atlassian/confluence/plugins/slack/util/compat/ConfluenceCompatibilityDispatcher.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.atlassian.confluence.plugins.slack.util.compat; - -import com.atlassian.confluence.util.GeneralUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -@Slf4j -@Component -public class ConfluenceCompatibilityDispatcher { - private ConfluenceCompatibilityHandler handler; - - public ConfluenceCompatibilityHandler getHandler() { - if (handler == null) { - String versionNumber = GeneralUtil.getVersionNumber(); - log.debug("Detected product version: {}", versionNumber); - - String[] versionParts = versionNumber.split("\\."); - if (versionParts.length < 1) { - throw new IllegalStateException("Version number is empty: " + versionNumber); - } - - String majorVersionString = versionParts[0]; - try { - int majorVersion = Integer.parseUnsignedInt(majorVersionString); - handler = majorVersion > 7 - ? Confluence8CompatibilityHandler.INSTANCE - : Confluence7CompatibilityHandler.INSTANCE; - } catch (NumberFormatException e) { - throw new IllegalStateException("Major version is not an integer: " + majorVersionString, e); - } - } - - return handler; - } -} diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml index ded61299..8ee9f1d0 100644 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/atlassian-plugin.xml @@ -170,7 +170,7 @@ weight="0"> Slack Space Configuration \ No newline at end of file diff --git a/jira-slack-server-integration/jira-8-compat/pom.xml b/jira-slack-server-integration/jira-8-compat/pom.xml index 0b363a41..61792723 100644 --- a/jira-slack-server-integration/jira-8-compat/pom.xml +++ b/jira-slack-server-integration/jira-8-compat/pom.xml @@ -12,6 +12,11 @@ Provides compatibility with Jira 8. + + org.springframework + spring-core + provided + org.apache.commons commons-lang3 diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml index 82fa3bfa..d3548e30 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml @@ -103,13 +103,13 @@ provided - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided - javax.annotation - javax.annotation-api + jakarta.annotation + jakarta.annotation-api provided @@ -551,7 +551,7 @@ com.atlassian.plugin atlassian-spring-scanner-maven-plugin - ${atlassian.spring.scanner.version} + 5.0.0 diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/service/ComponentImports.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/service/ComponentImports.java index f52601f3..6af6e459 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/service/ComponentImports.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/service/ComponentImports.java @@ -35,7 +35,6 @@ import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport; import com.atlassian.plugin.web.WebInterfaceManager; import com.atlassian.plugin.webresource.WebResourceIntegration; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.sal.api.ApplicationProperties; import com.atlassian.sal.api.auth.LoginUriProvider; import com.atlassian.sal.api.executor.ThreadLocalDelegateExecutorFactory; @@ -46,6 +45,7 @@ import com.atlassian.sal.api.web.context.HttpContext; import com.atlassian.soy.renderer.SoyTemplateRenderer; import com.atlassian.templaterenderer.TemplateRenderer; +import com.atlassian.webresource.api.WebResourceUrlProvider; import com.atlassian.webresource.api.assembler.PageBuilderService; @SuppressWarnings("unused") diff --git a/jira-slack-server-integration/pom.xml b/jira-slack-server-integration/pom.xml index 78f9af92..22603413 100644 --- a/jira-slack-server-integration/pom.xml +++ b/jira-slack-server-integration/pom.xml @@ -166,11 +166,11 @@ httpcore ${httpclient-core.version} - - org.springframework - spring-core - ${spring-beans.version} - + + + + + diff --git a/pom.xml b/pom.xml index 0f68c9be..e02bdf2e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 com.atlassian.plugins atlassian-slack-server-integration-parent @@ -23,8 +24,8 @@ UTF-8 UTF-8 - 1.8 - 1.8 + 17 + 17 ${project.basedir} ${project.root.directory} @@ -45,42 +46,21 @@ github - 2.1.7 - 3.15 - 1.7.25 - 3.1.0 2.25.0 4.13.2 5.7.1 - 2.9.2 2.3 - 4.7.2 3.8 1.11 - 2.9.2 - 2.1.0 - 4.0.0 - 1.3.0 + 6.0.0 4.10.0 - 3.0.1 - 5.3.18 - 5.3.19 - 3.0.15 - 3.0.1 3.0 - 2.1.0 1.3 - 3.0.0 - 0.9 2.0.2 - 2.1.1 - - 3.5.39 - 3.2.0 1.1.13 - 7.0.0-m40 + 7.0.4 @@ -156,19 +136,6 @@ 2.8.9 - - com.atlassian.plugin - atlassian-spring-scanner-annotation - ${atlassian.spring.scanner.version} - provided - - - - com.atlassian.soy - soy-template-renderer-api - ${soy-template-renderer.version} - - com.atlassian.plugins slack-server-integration-common @@ -181,33 +148,12 @@ test - - org.slf4j - slf4j-api - ${slf4j.version} - provided - - - org.slf4j - slf4j-simple - ${slf4j.version} - provided - joda-time joda-time ${joda-time.version} - - com.atlassian.analytics - analytics-api - ${analytics-api.version} - - - com.atlassian.sal - sal-api - ${sal.api.version} - + com.atlassian.user atlassian-user @@ -236,16 +182,6 @@ ${hamcrest-core.version} test - - javax.servlet - javax.servlet-api - ${servlet.version} - - - javax.annotation - javax.annotation-api - 1.3.2 - com.atlassian.ozymandias atlassian-plugin-point-safety @@ -290,11 +226,6 @@ 2.25.0 test - - com.atlassian.templaterenderer - atlassian-template-renderer-api - ${template.renderer.version} - org.mockito mockito-core @@ -307,47 +238,7 @@ test - - com.atlassian.plugins - atlassian-plugins-core - ${atlassian-plugins-core.version} - - - com.atlassian.plugins - atlassian-plugins-webfragment - ${atlassian-plugins-webfragment.version} - - - com.atlassian.plugins - atlassian-plugins-webresource - ${webresource.version} - - - fugue - com.atlassian.fugue - - - - - org.springframework - spring-test - ${spring-test.version} - - - org.springframework - spring-beans - ${spring-beans.version} - - - org.springframework - spring-webmvc - ${spring-beans.version} - - - org.springframework - spring-context - ${spring-beans.version} - + com.atlassian.activeobjects activeobjects-plugin @@ -359,11 +250,6 @@ - - io.atlassian.fugue - fugue - ${io.fugue.version} - org.apache.commons commons-lang3 @@ -385,26 +271,6 @@ commons-codec ${commons-codec.version} - - com.atlassian.annotations - atlassian-annotations - ${atlassian-annotations.version} - - - com.atlassian.event - atlassian-event - ${atlassian-event.version} - - - com.atlassian.util.concurrent - atlassian-util-concurrent - ${atlassian-concurrent.version} - - - com.atlassian.json - atlassian-json-api - ${atlassian-json-api.version} - org.powermock powermock-api-mockito2 @@ -437,22 +303,7 @@ - - com.atlassian.applinks - applinks-host - 4.1.1 - - - com.atlassian.applinks - applinks-api - 4.2.3 - - - com.atlassian.cache - atlassian-cache-api - ${atlassian-cache.version} - provided - + com.atlassian diff --git a/slack-server-integration-common/pom.xml b/slack-server-integration-common/pom.xml index 224cf46f..34befa96 100644 --- a/slack-server-integration-common/pom.xml +++ b/slack-server-integration-common/pom.xml @@ -43,19 +43,11 @@ com.atlassian.plugins atlassian-plugins-api - 4.5.1 provided - - - fugue - com.atlassian.fugue - - com.atlassian.fugue fugue - 1.2.0 provided @@ -88,6 +80,11 @@ atlassian-template-renderer-api provided + + com.atlassian.velocity.htmlsafe + velocity-htmlsafe + provided + commons-codec commons-codec @@ -101,16 +98,17 @@ javax.inject javax.inject + 1 provided - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided - javax.annotation - javax.annotation-api + jakarta.annotation + jakarta.annotation-api provided @@ -189,6 +187,16 @@ atlassian-spring-scanner-annotation provided + + com.atlassian.plugins + atlassian-plugins-core + provided + + + com.atlassian.util.concurrent + atlassian-util-concurrent + provided + @@ -247,6 +255,12 @@ atlassian-json-api provided + + org.glassfish.jersey.core + jersey-common + 2.42 + test + diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationContextDescriptor.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationContextDescriptor.java index 524579d2..96ba1870 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationContextDescriptor.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationContextDescriptor.java @@ -3,15 +3,15 @@ import com.atlassian.plugin.Plugin; import com.atlassian.plugin.PluginParseException; import com.atlassian.plugin.descriptors.AbstractModuleDescriptor; +import com.atlassian.plugin.module.Element; import com.atlassian.plugin.module.ModuleFactory; import com.atlassian.plugins.slack.api.notification.SlackNotificationContext; import com.atlassian.util.concurrent.ResettableLazyReference; -import org.dom4j.Element; public class SlackNotificationContextDescriptor extends AbstractModuleDescriptor { private String value; - private final ResettableLazyReference moduleReference = new ResettableLazyReference() { + private final ResettableLazyReference moduleReference = new ResettableLazyReference<>() { @Override protected SlackNotificationContext create() { return createModule(); diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationDescriptor.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationDescriptor.java index 23e95628..1e636909 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationDescriptor.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/descriptor/SlackNotificationDescriptor.java @@ -3,10 +3,10 @@ import com.atlassian.plugin.Plugin; import com.atlassian.plugin.PluginParseException; import com.atlassian.plugin.descriptors.AbstractModuleDescriptor; +import com.atlassian.plugin.module.Element; import com.atlassian.plugin.module.ModuleFactory; import com.atlassian.plugins.slack.api.notification.SlackNotification; import com.atlassian.util.concurrent.ResettableLazyReference; -import org.dom4j.Element; public class SlackNotificationDescriptor extends AbstractModuleDescriptor> { private String value; @@ -15,7 +15,7 @@ public class SlackNotificationDescriptor extends AbstractModuleDescriptor> moduleReference = new ResettableLazyReference>() { + private final ResettableLazyReference> moduleReference = new ResettableLazyReference<>() { @Override protected SlackNotification create() { return createModule(); diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java index 7fde5c4d..2ba775c2 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java @@ -8,6 +8,7 @@ import javax.ws.rs.core.UriBuilder; import java.net.URI; +import java.util.Arrays; @Component("slackRoutesProvider") public class DefaultSlackRoutesProvider implements SlackRoutesProvider { @@ -33,6 +34,6 @@ public URI baseUrl() { public URI getAdminConfigurationPage() { return UriBuilder.fromPath(SLACK_ADMIN_BASE) .path("configure") - .build(strBaseUrl()); + .build(new Object[]{strBaseUrl()}, false); } } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/DelegatingServletInputStream.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/DelegatingServletInputStream.java index 135ad42e..77547167 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/DelegatingServletInputStream.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/rest/DelegatingServletInputStream.java @@ -1,18 +1,52 @@ package com.atlassian.plugins.slack.rest; +import javax.servlet.ReadListener; import javax.servlet.ServletInputStream; import java.io.IOException; import java.io.InputStream; public class DelegatingServletInputStream extends ServletInputStream { private final InputStream delegate; + private boolean finished = false; - public DelegatingServletInputStream(final InputStream delegate) { + public DelegatingServletInputStream(InputStream delegate) { this.delegate = delegate; } - @Override + public final InputStream getSourceStream() { + return this.delegate; + } + public int read() throws IOException { - return delegate.read(); + int data = this.delegate.read(); + if (data == -1) { + this.finished = true; + } + + return data; + } + + public int available() throws IOException { + return this.delegate.available(); + } + + public void close() throws IOException { + super.close(); + this.delegate.close(); + } + + @Override + public boolean isFinished() { + return this.finished; + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) { + throw new UnsupportedOperationException(); } } diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/PluginResourceUrlSlackFunction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/PluginResourceUrlSlackFunction.java index 43686307..17a9c12f 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/PluginResourceUrlSlackFunction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/PluginResourceUrlSlackFunction.java @@ -1,14 +1,14 @@ package com.atlassian.plugins.slack.soy; -import com.atlassian.plugin.webresource.UrlMode; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.soy.renderer.SoyServerFunction; +import com.atlassian.webresource.api.UrlMode; +import com.atlassian.webresource.api.WebResourceUrlProvider; import com.google.common.collect.ImmutableSet; import java.util.Set; public class PluginResourceUrlSlackFunction implements SoyServerFunction { - private WebResourceUrlProvider webResourceUrlProvider; + private final WebResourceUrlProvider webResourceUrlProvider; public PluginResourceUrlSlackFunction(final WebResourceUrlProvider webResourceUrlProvider) { this.webResourceUrlProvider = webResourceUrlProvider; diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/WebPanelsSlackFunction.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/WebPanelsSlackFunction.java index 37ecab3d..6dd4aab4 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/WebPanelsSlackFunction.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/soy/WebPanelsSlackFunction.java @@ -1,7 +1,8 @@ package com.atlassian.plugins.slack.soy; import com.atlassian.plugin.web.WebInterfaceManager; -import com.atlassian.plugin.web.descriptors.WebPanelModuleDescriptor; +import com.atlassian.plugin.web.api.descriptors.WebPanelModuleDescriptor; +import com.atlassian.plugin.web.api.model.WebPanel; import com.atlassian.soy.renderer.JsExpression; import com.atlassian.soy.renderer.SoyClientFunction; import com.atlassian.soy.renderer.SoyServerFunction; @@ -44,7 +45,7 @@ public List apply(final Object... args) { final Map context = contextBuilder.build(); final List webPanels = new ArrayList<>(); - for (WebPanelModuleDescriptor webPanelModuleDescriptor : webInterfaceManager.getDisplayableWebPanelDescriptors(location, context)) { + for (WebPanelModuleDescriptor webPanelModuleDescriptor : webInterfaceManager.getDisplayableWebPanelDescriptors(location, context)) { try { webPanels.add(webPanelModuleDescriptor.getModule().getHtml(context)); } catch (RuntimeException e) { diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/velocity/VelocityPageBuilderService.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/velocity/VelocityPageBuilderService.java index 7c9832b8..1b2f51a2 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/velocity/VelocityPageBuilderService.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/velocity/VelocityPageBuilderService.java @@ -1,6 +1,6 @@ package com.atlassian.plugins.slack.velocity; -import com.atlassian.templaterenderer.annotations.HtmlSafe; +import com.atlassian.velocity.htmlsafe.HtmlSafe; import com.atlassian.webresource.api.assembler.PageBuilderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/slack-server-integration-common/src/main/resources/admin/configure-slack.vm b/slack-server-integration-common/src/main/resources/admin/configure-slack.vm index 4bc33271..157d9f9a 100644 --- a/slack-server-integration-common/src/main/resources/admin/configure-slack.vm +++ b/slack-server-integration-common/src/main/resources/admin/configure-slack.vm @@ -1,4 +1,4 @@ -#* @vtlvariable name="webResourceManager" type="com.atlassian.plugin.webresource.WebResourceManager" *# +#* @vtlvariable name="webResourceManager" type="com.atlassian.plugin.webresource.api.WebResourceManager" *# #* @vtlvariable name="pageBuilderService" type="com.atlassian.webresource.api.assembler.PageBuilderService" *# #* @vtlvariable name="webInterfaceManager" type="com.atlassian.plugin.web.WebInterfaceManager" *# #* @vtlvariable name="i18n" type="com.atlassian.sal.api.message.I18nResolver" *# diff --git a/slack-server-integration-common/src/main/resources/admin/connect/connect-workspace.vm b/slack-server-integration-common/src/main/resources/admin/connect/connect-workspace.vm index e0a6eec0..ab458519 100644 --- a/slack-server-integration-common/src/main/resources/admin/connect/connect-workspace.vm +++ b/slack-server-integration-common/src/main/resources/admin/connect/connect-workspace.vm @@ -1,4 +1,4 @@ -#* @vtlvariable name="webResourceManager" type="com.atlassian.plugin.webresource.WebResourceManager" *# +#* @vtlvariable name="webResourceManager" type="com.atlassian.plugin.webresource.api.WebResourceManager" *# #* @vtlvariable name="pageBuilderService" type="com.atlassian.webresource.api.assembler.PageBuilderService" *# #* @vtlvariable name="webInterfaceManager" type="com.atlassian.plugin.web.WebInterfaceManager" *# #* @vtlvariable name="i18n" type="com.atlassian.sal.api.message.I18nResolver" *# From afe803a20315898e0c36f02588c80e53f6c2a16e Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sat, 18 May 2024 00:39:34 +0300 Subject: [PATCH 03/11] Jira plugin adjustments to platform 7 --- .../pom.xml | 22 +++++++++----- .../impl/JiraSlackPluginResourceProvider.java | 4 +-- .../impl/DefaultAttachmentHelperTest.java | 2 +- .../JiraSlackPluginResourceProviderTest.java | 4 +-- .../web/rest/IssuePanelResourceTest.java | 9 +++--- jira-slack-server-integration/pom.xml | 29 ++----------------- .../routes/DefaultSlackRoutesProvider.java | 1 - 7 files changed, 28 insertions(+), 43 deletions(-) diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml index d3548e30..dbae653a 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml @@ -235,6 +235,12 @@ org.mockito mockito-core test + + + net.bytebuddy + byte-buddy + + org.powermock @@ -322,6 +328,12 @@ 2.6.1 test + + org.codehaus.jackson + jackson-core-asl + 1.9.13 + test + com.atlassian.plugin atlassian-spring-scanner-annotation @@ -466,10 +478,8 @@ com.atlassian.plugin.osgi.factory, com.atlassian.plugin.web, com.atlassian.plugin.webresource, - com.atlassian.plugin.webresource.condition, - com.atlassian.plugin.webresource.transformer, - com.atlassian.plugin.webresource.url, com.atlassian.plugin.servlet, + com.atlassian.plugins.rest.api* com.atlassian.query, com.atlassian.query.clause, com.atlassian.query.operand, @@ -484,7 +494,7 @@ com.atlassian.seraph.util, com.atlassian.templaterenderer, com.atlassian.webresource.api, - com.atlassian.webresource.api.prebake, + com.atlassian.webresource.spi, com.google.common.base, com.google.common.collect, @@ -496,9 +506,7 @@ javax.security.auth.x500, javax.servlet, javax.servlet.http, - javax.ws.rs, - javax.ws.rs.core, - javax.ws.rs.ext, + javax.ws.rs*;version="[2.0.0,3.0.0)", javax.xml.bind.annotation, javax.xml.stream, javax.xml.transform, diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProvider.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProvider.java index 347cf550..ac6886cc 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProvider.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProvider.java @@ -2,9 +2,9 @@ import com.atlassian.jira.plugins.slack.model.JiraPersonalNotificationTypes; import com.atlassian.jira.plugins.slack.util.PluginConstants; -import com.atlassian.plugin.webresource.UrlMode; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; import com.atlassian.plugins.slack.spi.SlackPluginResourceProvider; +import com.atlassian.webresource.api.UrlMode; +import com.atlassian.webresource.api.WebResourceUrlProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/service/notification/impl/DefaultAttachmentHelperTest.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/service/notification/impl/DefaultAttachmentHelperTest.java index 9d5727c5..b60edd3b 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/service/notification/impl/DefaultAttachmentHelperTest.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/service/notification/impl/DefaultAttachmentHelperTest.java @@ -143,7 +143,7 @@ public void buildIssueAttachment_withPriorityNullAndAnonymousUserNoPretextNoSite assertThat(result.getTitleLink(), startsWith("http://baseUrl/browse/K")); assertThat(result.getText(), is("Status: `S` Ass: *Unas* ")); assertThat(result.getFallback(), is("K S")); - assertThat(result.getFooter(), is(" | ")); + assertThat(result.getFooter(), is(" | ")); assertThat(result.getFooterIcon(), is("https://jira.com/context/avatar.png?format=png")); assertThat(result.getColor(), is("#2684FF")); assertThat(result.getFields(), contains(f)); diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProviderTest.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProviderTest.java index d8560716..c1ed97e0 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProviderTest.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/spi/impl/JiraSlackPluginResourceProviderTest.java @@ -1,7 +1,7 @@ package com.atlassian.jira.plugins.slack.spi.impl; -import com.atlassian.plugin.webresource.UrlMode; -import com.atlassian.plugin.webresource.WebResourceUrlProvider; +import com.atlassian.webresource.api.UrlMode; +import com.atlassian.webresource.api.WebResourceUrlProvider; import org.junit.Rule; import org.junit.Test; import org.mockito.InjectMocks; diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResourceTest.java b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResourceTest.java index f03c10a2..e32ff29d 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResourceTest.java +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/com/atlassian/jira/plugins/slack/web/rest/IssuePanelResourceTest.java @@ -34,8 +34,8 @@ public class IssuePanelResourceTest { @Mock UserProfile userProfile; - @Mock - UserKey userKey; +// @Mock +// UserKey userKey; @Mock ApplicationUser applicationUser; @Mock @@ -52,8 +52,9 @@ public void panelData_shouldForbidAccessForUnauthorizedUser() { String issueId = "some-issue-id"; String userKeyStr = "some-user-key"; when(userManager.getRemoteUser()).thenReturn(userProfile); - when(userProfile.getUserKey()).thenReturn(userKey); - when(userKey.getStringValue()).thenReturn(userKeyStr); + UserKey stubUserKey = new UserKey(userKeyStr); + when(userProfile.getUserKey()).thenReturn(stubUserKey); +// when(userKey.getStringValue()).thenReturn(userKeyStr); when(jiraUserManager.getUserByKey(userKeyStr)).thenReturn(applicationUser); when(issueManager.getIssueByKeyIgnoreCase(issueId)).thenReturn(mutableIssue); when(permissionManager.hasPermission(ProjectPermissions.BROWSE_PROJECTS, mutableIssue, applicationUser)) diff --git a/jira-slack-server-integration/pom.xml b/jira-slack-server-integration/pom.xml index 22603413..3ec4792f 100644 --- a/jira-slack-server-integration/pom.xml +++ b/jira-slack-server-integration/pom.xml @@ -22,12 +22,12 @@ 5.1.3 - 9.0.0 - 8.1.51 + 10.0.0-QR-20240423065758 + 8.2.2 ${jira.version} - 9.0.0 + 10.0.0-QR-20240423065758 ${jira.version} @@ -137,24 +137,6 @@ com.atlassian.jira.tests jira-testkit-client ${testkit.version} - - - jackson-jaxrs - org.codehaus.jackson - - - jackson-core-asl - org.codehaus.jackson - - - jackson-xc - org.codehaus.jackson - - - jackson-mapper-asl - org.codehaus.jackson - - com.atlassian.httpclient @@ -166,11 +148,6 @@ httpcore ${httpclient-core.version} - - - - - diff --git a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java index 2ba775c2..7664405b 100644 --- a/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java +++ b/slack-server-integration-common/src/main/java/com/atlassian/plugins/slack/api/routes/DefaultSlackRoutesProvider.java @@ -8,7 +8,6 @@ import javax.ws.rs.core.UriBuilder; import java.net.URI; -import java.util.Arrays; @Component("slackRoutesProvider") public class DefaultSlackRoutesProvider implements SlackRoutesProvider { From 4b2970db72d6b36b7d2a38d3f7337aeff6f02ba5 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sat, 18 May 2024 12:04:41 +0300 Subject: [PATCH 04/11] Bitbucket plugin adjustments to platform 7 --- bin/run-bitbucket.sh | 3 ++ .../pom.xml | 54 ++++++++++++++----- .../renderer/SlackLinkRendererTest.java | 22 +++++--- 3 files changed, 60 insertions(+), 19 deletions(-) diff --git a/bin/run-bitbucket.sh b/bin/run-bitbucket.sh index 4c42b219..5e00524b 100755 --- a/bin/run-bitbucket.sh +++ b/bin/run-bitbucket.sh @@ -7,12 +7,15 @@ trap 'set +ex' EXIT BB_NGROK="$(curl -s "http://127.0.0.1:4040/api/tunnels" | \ jq -r '.tunnels[] | select(.proto == "https") | select (.config.addr|endswith("'"7990"'")) | .public_url[8:]')" +# TODO: Remove -Denforcer.skip=true after moving from milestone versions + ( cd "$( dirname "${BASH_SOURCE[0]}")/.." ; # set env var BB_NGROK to enable HTTPS atlas-mvn bitbucket:debug \ + -Denforcer.skip=true \ -Datlassian.dev.mode=true \ -Dmaven.test.skip=true \ -Dlogging.level.com.atlassian.bitbucket.plugins.slack=TRACE \ diff --git a/bitbucket-slack-server-integration-plugin/pom.xml b/bitbucket-slack-server-integration-plugin/pom.xml index 3daa906b..73ee350f 100644 --- a/bitbucket-slack-server-integration-plugin/pom.xml +++ b/bitbucket-slack-server-integration-plugin/pom.xml @@ -18,8 +18,8 @@ UTF-8 UTF-8 - 1.8 - 1.8 + 17 + 17 @@ -35,22 +35,20 @@ github - 2.1.7 + 5.0.0 5.7.1 2.25.0 3.0.0 - 0.9 - 3.0.0 1.11 1.1.13 ${project.groupId}.${project.artifactId} - 7.6.0 - 7.6.0 + 9.0.0-plat-7-m20 + 9.0.0-plat-7-m20 ${bitbucket.version} 8.2.2 - 7.0.0-m40 + 7.0.3 @@ -163,7 +161,6 @@ com.atlassian.json atlassian-json-api - ${atlassian-json-api.version} provided @@ -179,6 +176,7 @@ javax.inject javax.inject + 1 provided @@ -227,7 +225,6 @@ com.atlassian.util.concurrent atlassian-util-concurrent - ${atlassian-concurrent.version} provided @@ -245,6 +242,11 @@ fugue provided + + com.atlassian.analytics + analytics-api + provided + @@ -274,8 +276,8 @@ provided - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided @@ -397,6 +399,34 @@ bitbucket-it-common ${bitbucket.version} test + + + com.sun.jersey + jersey-core + + + com.sun.jersey + jersey-server + + + com.sun.jersey + jersey-servlet + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-json + + + + + org.glassfish.jersey.core + jersey-common + 2.42 + test commons-lang diff --git a/bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackLinkRendererTest.java b/bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackLinkRendererTest.java index e1546674..ac235fdb 100644 --- a/bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackLinkRendererTest.java +++ b/bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackLinkRendererTest.java @@ -32,6 +32,9 @@ import static org.hamcrest.Matchers.is; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -262,13 +265,18 @@ public void oAuthSessionsPageUrl_shouldReturnExpectedValue() { @Test public void adminConfigurationPage_shouldReturnExpectedValue() { - String result = renderer.adminConfigurationPage("T"); - - assertThat(result, is(navBuilder - .pluginServlets() - .path(SLACK_PATH, CONFIGURE_PATH) - .withParam("teamId", "T") - .buildAbsolute())); + // DummyNavBuilder fails to mock `withParam(name, value)` so that mocking manually + NavBuilder.PluginServlets pluginServlets = mock(NavBuilder.PluginServlets.class); + doReturn(pluginServlets).when(navBuilder).pluginServlets(); + when(pluginServlets.path(SLACK_PATH, CONFIGURE_PATH)).thenReturn(pluginServlets); + when(pluginServlets.withParam("teamId", "T")).thenReturn(pluginServlets); + + renderer.adminConfigurationPage("T"); + + verify(navBuilder).pluginServlets(); + verify(pluginServlets).path(SLACK_PATH, CONFIGURE_PATH); + verify(pluginServlets).withParam("teamId", "T"); + verify(pluginServlets).buildAbsolute(); } @Test From cdc9d0d7ddc7b3287bb7422b8594ce60d0577642 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sat, 18 May 2024 13:49:12 +0300 Subject: [PATCH 05/11] Run unit tests skipping enforcer until moved out from milestone versions --- bin/build/run-unit-tests.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/build/run-unit-tests.sh b/bin/build/run-unit-tests.sh index f990a377..bac3be84 100755 --- a/bin/build/run-unit-tests.sh +++ b/bin/build/run-unit-tests.sh @@ -2,5 +2,7 @@ set -ex trap 'set +ex' EXIT +# TODO: Remove -Denforcer.skip=true after moving from milestone versions + atlas-version -atlas-mvn --batch-mode verify -P jacoco +atlas-mvn --batch-mode verify -P jacoco -Denforcer.skip=true From 52dd6c76983df9b762bfb4ce1d3f4e7b509556ed Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sat, 18 May 2024 23:52:57 +0300 Subject: [PATCH 06/11] Major version update --- bitbucket-slack-server-integration-plugin/pom.xml | 4 ++-- .../confluence-slack-server-integration-plugin/pom.xml | 4 ++-- confluence-slack-integration/pom.xml | 2 +- jira-slack-server-integration/jira-8-compat/pom.xml | 2 +- .../jira-service-desk-4-compat/pom.xml | 2 +- .../jira-service-desk-compat-common/pom.xml | 2 +- .../jira-service-desk-compat-main/pom.xml | 2 +- .../jira-service-desk-compat/pom.xml | 2 +- .../jira-slack-server-integration-plugin/pom.xml | 4 ++-- jira-slack-server-integration/pom.xml | 4 ++-- pom.xml | 4 ++-- slack-server-integration-common/pom.xml | 2 +- slack-server-integration-test-common/pom.xml | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bitbucket-slack-server-integration-plugin/pom.xml b/bitbucket-slack-server-integration-plugin/pom.xml index 73ee350f..ddf419c5 100644 --- a/bitbucket-slack-server-integration-plugin/pom.xml +++ b/bitbucket-slack-server-integration-plugin/pom.xml @@ -5,7 +5,7 @@ com.atlassian.bitbucket.plugins bitbucket-slack-server-integration-plugin atlassian-plugin - 4.0.11-SNAPSHOT + 5.0.0-SNAPSHOT Slack for Bitbucket Data Center This is the Slack integration for Bitbucket Data Center @@ -40,7 +40,7 @@ 2.25.0 3.0.0 1.11 - 1.1.13 + 2.0.0 ${project.groupId}.${project.artifactId} diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml index c54e3ef7..421d592d 100755 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml @@ -4,14 +4,14 @@ com.atlassian.plugins confluence-slack-integration - 1.1.13 + 2.0.0 com.atlassian.confluence.plugins confluence-slack-server-integration-plugin atlassian-plugin Slack for Confluence Data Center - 3.0.6-SNAPSHOT + 4.0.0-SNAPSHOT This is the Slack integration for Confluence Data Center diff --git a/confluence-slack-integration/pom.xml b/confluence-slack-integration/pom.xml index 8f2875bc..d26685c6 100644 --- a/confluence-slack-integration/pom.xml +++ b/confluence-slack-integration/pom.xml @@ -6,7 +6,7 @@ atlassian-slack-server-integration-parent com.atlassian.plugins - 1.1.13 + 2.0.0 confluence-slack-integration diff --git a/jira-slack-server-integration/jira-8-compat/pom.xml b/jira-slack-server-integration/jira-8-compat/pom.xml index 61792723..c7a0fdb4 100644 --- a/jira-slack-server-integration/jira-8-compat/pom.xml +++ b/jira-slack-server-integration/jira-8-compat/pom.xml @@ -3,7 +3,7 @@ jira-slack-server-integration com.atlassian.plugins - 1.1.13 + 2.0.0 4.0.0 diff --git a/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-4-compat/pom.xml b/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-4-compat/pom.xml index 822d709a..c6522705 100644 --- a/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-4-compat/pom.xml +++ b/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-4-compat/pom.xml @@ -5,7 +5,7 @@ jira-service-desk-compat com.atlassian.plugins - 1.1.13 + 2.0.0 4.0.0 diff --git a/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-common/pom.xml b/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-common/pom.xml index 4ce2ca37..c4337c27 100644 --- a/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-common/pom.xml +++ b/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-common/pom.xml @@ -5,7 +5,7 @@ jira-service-desk-compat com.atlassian.plugins - 1.1.13 + 2.0.0 4.0.0 diff --git a/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-main/pom.xml b/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-main/pom.xml index 488cf298..ce56c54f 100644 --- a/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-main/pom.xml +++ b/jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-main/pom.xml @@ -5,7 +5,7 @@ jira-service-desk-compat com.atlassian.plugins - 1.1.13 + 2.0.0 4.0.0 diff --git a/jira-slack-server-integration/jira-service-desk-compat/pom.xml b/jira-slack-server-integration/jira-service-desk-compat/pom.xml index e170f4cd..f0763084 100644 --- a/jira-slack-server-integration/jira-service-desk-compat/pom.xml +++ b/jira-slack-server-integration/jira-service-desk-compat/pom.xml @@ -5,7 +5,7 @@ jira-slack-server-integration com.atlassian.plugins - 1.1.13 + 2.0.0 4.0.0 pom diff --git a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml index dbae653a..8cdd6a6c 100644 --- a/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml +++ b/jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml @@ -4,13 +4,13 @@ com.atlassian.plugins jira-slack-server-integration - 1.1.13 + 2.0.0 com.atlassian.jira.plugins jira-slack-server-integration-plugin atlassian-plugin - 3.0.10-SNAPSHOT + 4.0.0-SNAPSHOT Slack for Jira Data Center This is the Slack plugin for Jira Data Center diff --git a/jira-slack-server-integration/pom.xml b/jira-slack-server-integration/pom.xml index 3ec4792f..cab26a93 100644 --- a/jira-slack-server-integration/pom.xml +++ b/jira-slack-server-integration/pom.xml @@ -4,12 +4,12 @@ com.atlassian.plugins atlassian-slack-server-integration-parent - 1.1.13 + 2.0.0 jira-slack-server-integration pom - 1.1.13 + 2.0.0 Jira Slack Integration Modules diff --git a/pom.xml b/pom.xml index e02bdf2e..6fd43cf0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.atlassian.plugins atlassian-slack-server-integration-parent - 1.1.13 + 2.0.0 pom Atlassian Slack Integration for Server Project @@ -59,7 +59,7 @@ 1.3 2.0.2 - 1.1.13 + 2.0.0 7.0.4 diff --git a/slack-server-integration-common/pom.xml b/slack-server-integration-common/pom.xml index 34befa96..ab8f3821 100644 --- a/slack-server-integration-common/pom.xml +++ b/slack-server-integration-common/pom.xml @@ -4,7 +4,7 @@ com.atlassian.plugins atlassian-slack-server-integration-parent - 1.1.13 + 2.0.0 slack-server-integration-common diff --git a/slack-server-integration-test-common/pom.xml b/slack-server-integration-test-common/pom.xml index 3c0528db..916fa3c2 100644 --- a/slack-server-integration-test-common/pom.xml +++ b/slack-server-integration-test-common/pom.xml @@ -5,7 +5,7 @@ atlassian-slack-server-integration-parent com.atlassian.plugins - 1.1.13 + 2.0.0 4.0.0 From 4b5d9ff4cc5736c3f6d61dee288625f4b655b8f0 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sun, 19 May 2024 11:55:08 +0300 Subject: [PATCH 07/11] Adjustments to JDK 17 --- .../jira-8-compat/pom.xml | 5 ++++ pom.xml | 29 ++++++++----------- slack-server-integration-common/pom.xml | 5 ++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/jira-slack-server-integration/jira-8-compat/pom.xml b/jira-slack-server-integration/jira-8-compat/pom.xml index c7a0fdb4..caff1d51 100644 --- a/jira-slack-server-integration/jira-8-compat/pom.xml +++ b/jira-slack-server-integration/jira-8-compat/pom.xml @@ -52,6 +52,11 @@ org.mockito mockito-core + + net.bytebuddy + byte-buddy + 1.11.22 + org.hamcrest hamcrest-core diff --git a/pom.xml b/pom.xml index 6fd43cf0..914cf0ab 100644 --- a/pom.xml +++ b/pom.xml @@ -61,6 +61,7 @@ 2.0.0 7.0.4 + @@ -72,9 +73,12 @@ 1.0-alpha-2 - org.apache.maven.surefire + org.apache.maven.plugins maven-surefire-plugin 2.22.1 + + ${jvm17.opens} + org.apache.maven.plugins @@ -327,24 +331,15 @@ - + + --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.ref=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens=java.base/sun.util.locale=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xml.internal.utils=ALL-UNNAMED --add-exports=java.desktop/sun.font=ALL-UNNAMED --add-exports=java.base/sun.security.util=ALL-UNNAMED + + jacoco diff --git a/slack-server-integration-common/pom.xml b/slack-server-integration-common/pom.xml index ab8f3821..a382d880 100644 --- a/slack-server-integration-common/pom.xml +++ b/slack-server-integration-common/pom.xml @@ -234,6 +234,11 @@ mockito-core test + + net.bytebuddy + byte-buddy + 1.11.22 + joda-time joda-time From 5510527feccb3ff897ca0e3faeed5d88f70a5751 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sun, 19 May 2024 13:07:46 +0300 Subject: [PATCH 08/11] Decrease platform version to 7.0.0 to get publicly available dependencies versions --- bitbucket-slack-server-integration-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bitbucket-slack-server-integration-plugin/pom.xml b/bitbucket-slack-server-integration-plugin/pom.xml index ddf419c5..9be8bcc1 100644 --- a/bitbucket-slack-server-integration-plugin/pom.xml +++ b/bitbucket-slack-server-integration-plugin/pom.xml @@ -48,7 +48,7 @@ 9.0.0-plat-7-m20 ${bitbucket.version} 8.2.2 - 7.0.3 + 7.0.0 diff --git a/pom.xml b/pom.xml index 914cf0ab..b68b694e 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ 2.0.2 2.0.0 - 7.0.4 + 7.0.0 From faa5c70f30506814fba8fb4645235ffc58bc3d95 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sun, 19 May 2024 13:57:51 +0300 Subject: [PATCH 09/11] Align build scripts --- bin/build/install-common-modules.sh | 3 --- bin/pack-compat-confluence.sh | 13 ------------- confluence.sh | 4 ---- 3 files changed, 20 deletions(-) delete mode 100755 bin/pack-compat-confluence.sh diff --git a/bin/build/install-common-modules.sh b/bin/build/install-common-modules.sh index 95049be0..af11d3ee 100755 --- a/bin/build/install-common-modules.sh +++ b/bin/build/install-common-modules.sh @@ -11,8 +11,5 @@ jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat- jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-4-compat,\ jira-slack-server-integration/jira-service-desk-compat/jira-service-desk-compat-main,\ confluence-slack-integration,\ -confluence-slack-integration/confluence-compat-common,\ -confluence-slack-integration/confluence-7-compat,\ -confluence-slack-integration/confluence-8-compat,\ slack-server-integration-test-common \ -Dmaven.test.skip=true diff --git a/bin/pack-compat-confluence.sh b/bin/pack-compat-confluence.sh deleted file mode 100755 index f8f151a7..00000000 --- a/bin/pack-compat-confluence.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -( - cd "$( dirname "${BASH_SOURCE[0]}")/.." ; - atlas-mvn install --batch-mode -Dmaven.test.skip=true "$@" -pl \ -com.atlassian.plugins:confluence-compat-common,\ -com.atlassian.plugins:confluence-7-compat,\ -com.atlassian.plugins:confluence-8-compat && \ - rm -rf confluence-slack-integration/confluence-slack-server-integration-plugin/target/classes/com/atlassian/confluence/plugins/slack/util/compat && \ - rm -f confluence-slack-integration/confluence-slack-server-integration-plugin/target/dependency-maven-plugin-markers/com.atlassian.plugins-confluence-compat-common-jar-* - rm -f confluence-slack-integration/confluence-slack-server-integration-plugin/target/dependency-maven-plugin-markers/com.atlassian.plugins-confluence-7-compat-jar-* - rm -f confluence-slack-integration/confluence-slack-server-integration-plugin/target/dependency-maven-plugin-markers/com.atlassian.plugins-confluence-8-compat-jar-* -) diff --git a/confluence.sh b/confluence.sh index e819430e..ab19803a 100755 --- a/confluence.sh +++ b/confluence.sh @@ -6,7 +6,6 @@ Arguments: - run compile the common module, the Confluence plugin, and start up Confluence for development - pack compile the Confluence plugin ('pack' is skipped if 'run' is passed) - common compile common module - - compat compile Confluence 8 compatibility module - clean clear compiled files, except Confluence home directory ('clean' is skipped if 'purge' is passed) - purge clear all compiled files, including Confluence home directory with database and everything - deps clean the plugin's embedded dependencies, forcing them to be rebuild in the next compilation @@ -34,8 +33,6 @@ pack=$([[ "$*" == *"pack"* || "$empty" == "yes" ]] && ([[ "$run" == "yes" ]] && common=$([[ "$*" == *"common"* || "$empty" == "yes" || "$run" == "yes" ]] && echo "yes" || echo "no") # enabled by default or when run is passed -compat=$([[ "$*" == *"compat"* ]] && echo "yes" || echo "no") - deps=$([[ "$*" == *"deps"* ]] && echo "yes" || echo "no") # it cleans dependencies when building the plugin help=$([[ "$*" == *"help"* ]] && echo "yes" || echo "no") @@ -52,7 +49,6 @@ export PLUGIN="confluence-slack-integration/confluence-slack-server-integration- ([[ "$clean" != "yes" ]] || atlas-mvn clean) && \ ([[ "$purge" != "yes" ]] || (rm -rf ${PLUGIN}/target && atlas-mvn clean)) && \ ([[ "$common" != "yes" ]] || ./bin/pack-common.sh) && \ - ([[ "$compat" != "yes" ]] || ./bin/pack-compat-confluence.sh) && \ ([[ "$deps" != "yes" ]] || (rm -f ${PLUGIN}/target/dependency-maven-plugin-markers/*.marker && rm -rf ${PLUGIN}/target/classes)) && \ ([[ "$pack" != "yes" ]] || bin/pack-plugin.sh) && \ ([[ "$run" != "yes" ]] || ./bin/run-confluence.sh) From ad8f8f724cb9c42954671d91ebf76621ae689668 Mon Sep 17 00:00:00 2001 From: YevhenHrytsai <142490819+yevhenhrytsai@users.noreply.github.com> Date: Sun, 19 May 2024 17:19:54 +0300 Subject: [PATCH 10/11] Update java-product-matrix.json with confluence 9.0.0-m72 --- bin/build/java-product-matrix.json | 4 ++-- .../confluence-slack-server-integration-plugin/pom.xml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/build/java-product-matrix.json b/bin/build/java-product-matrix.json index 781228e1..8f381ad1 100644 --- a/bin/build/java-product-matrix.json +++ b/bin/build/java-product-matrix.json @@ -9,7 +9,7 @@ }, "confluence-it": { "java-version": ["17"], - "confluence-version": ["9.0.0-m81"] + "confluence-version": ["9.0.0-m72"] }, "bitbucket-it": { "java-version": ["17"], @@ -55,4 +55,4 @@ ] } } -} \ No newline at end of file +} diff --git a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml index 421d592d..b964051c 100755 --- a/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml +++ b/confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml @@ -28,7 +28,7 @@ 9.0.0-m81 ${confluence.version} - 8.6.0 + 8.9.2 @@ -98,6 +98,7 @@ com.atlassian.cache atlassian-cache-api + provided org.apache.commons From b308f354ae05ce1d51fce069806a056bcc2b5cb5 Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Mon, 20 May 2024 02:31:29 +0300 Subject: [PATCH 11/11] Update README.md and CONTRIBUTING.md --- CONTRIBUTING.md | 5 ++++- README.md | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e78ed28..b6b9de3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,10 @@ Thank you for considering a contribution to Atlassian Slack Integration for Server project! Pull requests, issues and comments are welcome. For pull requests, please: -* Use `dev` as base branch for your changes and target branch for your PRs +> `dev` branch contains plugins compatible with Confluence 9+, Bitbucket 9+ and Jira 10+ products +> `release-1.x` compatible with older products versions (Confluence 7, 8; Bitbucket 8 and Jira 8, 9) + +* Use `dev`/`release-1.x` as base branch for your changes and target branch for your PRs * Add tests for new features and bug fixes * Follow the existing style * Separate unrelated changes into multiple pull requests diff --git a/README.md b/README.md index 14165e89..1f17b4b5 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,16 @@ or by manually downloading plugin JAR files from Marketplace pages for [Jira](ht or [Bitbucket](https://marketplace.atlassian.com/apps/1220729/bitbucket-server-for-slack-official?hosting=datacenter&tab=overview) plugins. Links to the official documentation are specified on Marketplace pages. -Supported products (on 10th Feb, 2023). See [EOL policy](https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html). -* Jira: 8.15.0 (EOL date: 2 Feb 2023) JDK 8, 11 - 9.5.0 (EOL date: 6 Dec 2024) on JDK 8, 11, 17. -* Confluence: 7.10 (EOL date: Dec 15, 2022) JDK 8, 11 - 8.0.0-m90 (EOL date: TBD - end of 2024) JDK 8, 11. -* Bitbucket: 7.6.0 (EOL date: Q1 calendar year 2023) on JDK 8, 11 - 8.8.0 (EOL date: 7 Feb 2025) on JDK 8, 11, 17. +Supported products. See [EOL policy](https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html). +* `master`/`dev` branch + * Jira: 10+ (not released yet) on JDK 17. + * Confluence: 9+ (not released yet) on JDK 17. + * Bitbucket: 9+ (not released yet) on JDK 17. + +* `release-1.x` branch + * Jira: 8.15.0 (EOL date: 2 Feb 2023) JDK 8, 11 - 9.5.0 (EOL date: 6 Dec 2024) on JDK 8, 11, 17. + * Confluence: 7.10 (EOL date: Dec 15, 2022) JDK 8, 11 - 8.0.0-m90 (EOL date: TBD - end of 2024) JDK 8, 11. + * Bitbucket: 7.6.0 (EOL date: Q1 calendar year 2023) on JDK 8, 11 - 8.8.0 (EOL date: 7 Feb 2025) on JDK 8, 11, 17. ## A note on future development plans @@ -27,10 +33,12 @@ When Jira, Confluence, or Bitbucket Data Center release new versions, we will va # Installation -1. Download and install [JDK 8](https://www.oracle.com/java/technologies/javase-downloads.html). After installation ` +1. Download and install [JDK 17](https://adoptium.net/en-GB/temurin/releases/?version=17). After installation ` java` command should be available in the terminal and `JAVA_HOME` environment variable should point to JDK installation directory. Running `$JAVA_HOME/bin/java -version` should print a JDK version. -*Note*: Plugin can be compiled and run using **JDK 11**, but some old products may not support it. +> **Note:** Use [JDK 8](https://adoptium.net/en-GB/temurin/releases/?version=8) / [JDK 11](https://adoptium.net/en-GB/temurin/releases/?version=11) if working with the `release-1.x` branch +> +> **Note:** Plugin can be compiled and run using **JDK 11**, but some old products may not support it. 2. Download and install [Atlassian Plugin SDK](https://developer.atlassian.com/server/framework/atlassian-sdk/install-the-atlassian-sdk-on-a-linux-or-mac-system/). After successful installation running `atlas-version` should print SDK version. 3. (Optional) Install [ngrok](https://ngrok.com/) to enable Slack -> product features (slash commands, unfurling).