Fixed issue with thread

This commit is contained in:
Luca Frosini 2022-05-10 11:13:50 +02:00
parent d5ef34dd49
commit 4dd7aa5efb
3 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for gCube Catalogue (gCat) Service # Changelog for gCube Catalogue (gCat) Service
## [v2.2.0] ## [v2.2.0-SNAPSHOT]
- Switched gcat credentials to new IAM authz [#21628][#22727] - Switched gcat credentials to new IAM authz [#21628][#22727]
- Added support to manage configurations [#22658][#22742] - Added support to manage configurations [#22658][#22742]

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.data-catalogue</groupId> <groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcat</artifactId> <artifactId>gcat</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>2.2.0</version> <version>2.2.0-SNAPSHOT</version>
<name>gCube Catalogue (gCat) Service</name> <name>gCube Catalogue (gCat) Service</name>
<description> <description>
This service allows any client to publish on the gCube Catalogue. This service allows any client to publish on the gCube Catalogue.
@ -72,7 +72,6 @@
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId> <artifactId>authorization-utils</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>

View File

@ -33,11 +33,15 @@ public class SocialMessage extends Thread {
protected final ObjectMapper objectMapper; protected final ObjectMapper objectMapper;
private final String token;
protected Message message; protected Message message;
public SocialMessage() throws Exception { public SocialMessage() throws Exception {
super(); super();
this.objectMapper = new ObjectMapper(); this.objectMapper = new ObjectMapper();
SecretManager secretManager = SecretManagerProvider.instance.get();
this.token = secretManager.getCurrentSecretHolder().getSecrets().first().getToken();
} }
public Message getMessage() { public Message getMessage() {
@ -76,8 +80,7 @@ public class SocialMessage extends Thread {
GXHTTPStringRequest gxhttpStringRequest = GXHTTPStringRequest.newRequest(basePath); GXHTTPStringRequest gxhttpStringRequest = GXHTTPStringRequest.newRequest(basePath);
gxhttpStringRequest.from(Constants.CATALOGUE_NAME); gxhttpStringRequest.from(Constants.CATALOGUE_NAME);
gxhttpStringRequest.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); gxhttpStringRequest.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
SecretManager secretManager = SecretManagerProvider.instance.get(); gxhttpStringRequest.setSecurityToken(token);
gxhttpStringRequest.setSecurityToken(secretManager.getCurrentSecretHolder().getSecrets().first().getToken());
gxhttpStringRequest.path(SOCIAL_SERVICE_SEND_MESSAGE_PATH); gxhttpStringRequest.path(SOCIAL_SERVICE_SEND_MESSAGE_PATH);
HttpURLConnection httpURLConnection = gxhttpStringRequest.post(messageString); HttpURLConnection httpURLConnection = gxhttpStringRequest.post(messageString);