All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.ibodrov.mica.server.ui.WhoamiResource Maven / Gradle / Ivy

There is a newer version: 0.0.25
Show newest version
package ca.ibodrov.mica.server.ui;

import com.walmartlabs.concord.server.sdk.rest.Resource;
import com.walmartlabs.concord.server.security.UserPrincipal;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;

import static javax.ws.rs.core.MediaType.APPLICATION_JSON;

@Path("/api/mica/ui/whoami")
public class WhoamiResource implements Resource {

    @GET
    @Produces(APPLICATION_JSON)
    public WhoamiResponse whoami(@Context UserPrincipal session) {
        return new WhoamiResponse(session.getUsername());
    }

    public record WhoamiResponse(String username) {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy