feat: add keycloak account creation and club groupe set
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.rest.data.UserInfo;
|
||||
import io.quarkus.security.Authenticated;
|
||||
import io.quarkus.security.identity.SecurityIdentity;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -9,6 +10,7 @@ import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.eclipse.microprofile.jwt.JsonWebToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -22,6 +24,9 @@ public class AuthEndpoints {
|
||||
@Inject
|
||||
SecurityIdentity securityIdentity;
|
||||
|
||||
@Inject
|
||||
JsonWebToken accessToken;
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public Boolean auth() {
|
||||
@@ -30,9 +35,10 @@ public class AuthEndpoints {
|
||||
|
||||
@GET
|
||||
@Path("/userinfo")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String userinfo() {
|
||||
return securityIdentity.getPrincipal().getName();
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public UserInfo userinfo() {
|
||||
return UserInfo.makeUserInfo(accessToken, securityIdentity);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
Reference in New Issue
Block a user