hello-world-service/src/main/java/org/gcube/service/helloworld/services/HelloService.java

28 lines
714 B
Java

package org.gcube.service.helloworld.services;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.common.security.secrets.Secret;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Path("hello")
public class HelloService {
private final Logger logger = LoggerFactory.getLogger(HelloService.class);
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
Secret secret = SecretManagerProvider.instance.get();
String userId = secret.getOwner().getId();
logger.info("caller id is {}",userId);
return String.format("Hello %s", userId);
}
}