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

io.quarkus.qe.GreetingResource Maven / Gradle / Ivy

There is a newer version: 1.6.0.Beta17
Show newest version
package io.quarkus.qe;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.SecurityContext;

import io.quarkus.security.Authenticated;

@Path("/greeting")
public class GreetingResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayHello() {
        return "Hello World!";
    }

    @Authenticated
    @Path("/mutual-tls")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayHelloClient(@Context SecurityContext securityContext) {
        return "Hello %s!".formatted(securityContext.getUserPrincipal().getName());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy