37 lines
1.3 KiB
Java
37 lines
1.3 KiB
Java
package ch.gtache.elderscrollslegends.service.pubsub;
|
|
|
|
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
|
import ch.gtache.elderscrollslegends.service.ResultCode;
|
|
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.ws.rs.GET;
|
|
import jakarta.ws.rs.HeaderParam;
|
|
import jakarta.ws.rs.Path;
|
|
import jakarta.ws.rs.Produces;
|
|
import org.jboss.logging.Logger;
|
|
|
|
import java.util.Objects;
|
|
|
|
@Path("pubsubauth")
|
|
public class PubSubAuthEndpoints extends BaseEndpoints {
|
|
|
|
private static final Logger logger = Logger.getLogger(PubSubAuthEndpoints.class);
|
|
|
|
private final PubSubService pubSubService;
|
|
|
|
@Inject
|
|
PubSubAuthEndpoints(final AccountService accountService, final PubSubService pubSubService) {
|
|
super(accountService);
|
|
this.pubSubService = Objects.requireNonNull(pubSubService);
|
|
}
|
|
|
|
@GET
|
|
@Produces("application/json")
|
|
public PubSubResponse get(@HeaderParam("Authorization") final String authentication) {
|
|
final var steamID = authenticateOrThrow(authentication);
|
|
logger.info("get called by " + steamID);
|
|
final var chatRooms = pubSubService.getChatRooms(steamID);
|
|
return new PubSubResponse(ResultCode.Ok, "", authentication.replace("Bearer ", ""), chatRooms);
|
|
}
|
|
}
|