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
## [v2.2.0]
## [v2.2.0-SNAPSHOT]
- Switched gcat credentials to new IAM authz [#21628][#22727]
- Added support to manage configurations [#22658][#22742]

View File

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

View File

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