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

org.wildfly.swarm.keycloak.SecuredResource Maven / Gradle / Ivy

There is a newer version: 2.2.1.Final
Show newest version
package org.wildfly.swarm.keycloak;

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

import org.wildfly.swarm.keycloak.deployment.KeycloakSecurityContextAssociation;

@Path("/secured")
@Produces("text/plain")
public class SecuredResource {

    @GET
    public String get() {
        return "Hi " + KeycloakSecurityContextAssociation.get().getToken().getPreferredUsername()
            +  ", this resource is secured";
    }

    @GET
    @Path("sub")
    public String getSub() {
        return get();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy