diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/MetadataUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/MetadataUtility.java index f1a7453..f6c5103 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/MetadataUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/MetadataUtility.java @@ -10,6 +10,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonMappingException; import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; import org.gcube.common.authorization.utils.manager.SecretManagerProvider; +import org.gcube.common.authorization.utils.user.User; import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.model.reference.properties.Metadata; @@ -29,13 +30,14 @@ public class MetadataUtility { private static final Logger logger = LoggerFactory.getLogger(MetadataUtility.class); public static String getUser() { - String user = Metadata.UNKNOWN_USER; + String username = Metadata.UNKNOWN_USER; try { - user = SecretManagerProvider.instance.get().getUser().getUsername(); + User user = SecretManagerProvider.instance.get().getUser(); + username = user.getUsername(); } catch(Exception e) { - logger.error("Unable to retrieve user. {} will be used", user); + logger.error("Unable to retrieve user. {} will be used", username, e); } - return user; + return username; } public static Metadata createMetadata() {