Compare commits
4 commits
2a66027bea
...
e4b4497b30
| Author | SHA1 | Date | |
|---|---|---|---|
|
e4b4497b30 |
|||
|
8e9674cf5c |
|||
|
9a4dbfeb16 |
|||
|
c518d4a514 |
4 changed files with 6 additions and 14 deletions
|
|
@ -10,4 +10,4 @@ services:
|
|||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./local-dev/providers/:/opt/keycloak/providers/
|
||||
- ./ssh-key-provider/target/ssh-key-provider-1.0-SNAPSHOT.jar:/opt/keycloak/providers/ssh-key-provider.jar
|
||||
|
|
@ -6,6 +6,7 @@ import java.util.stream.Stream;
|
|||
import org.jboss.logging.Logger;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
|
@ -35,19 +36,9 @@ public class SSHKeyResourceProvider implements RealmResourceProvider {
|
|||
}
|
||||
|
||||
@GET
|
||||
@Path("hello")
|
||||
@Path("export/{group_id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Operation(summary = "Public hello endpoint", description = "This endpoint returns hello and the name of the requested realm.")
|
||||
@APIResponse(responseCode = "200", description = "", content = {
|
||||
@Content(schema = @Schema(implementation = Response.class, type = SchemaType.OBJECT)) })
|
||||
public Response helloAnonymous() {
|
||||
return Response.ok(Map.of("hello", session.getContext().getRealm().getName())).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("hello-auth")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response helloAuthenticated() {
|
||||
public Response exportKeys(@PathParam("group_id") String groupId) {
|
||||
UserProvider userProvider = session.users();
|
||||
|
||||
try {
|
||||
|
|
@ -55,7 +46,8 @@ public class SSHKeyResourceProvider implements RealmResourceProvider {
|
|||
authResult -> authResult.getToken().getIssuedFor().equals("admin-cli"));
|
||||
|
||||
RealmModel realm = session.getContext().getRealm();
|
||||
GroupModel group = realm.getGroupById("fbf5f78b-d2be-49dd-b04f-11a5e8ee583f");
|
||||
// TODO: add allowlist check
|
||||
GroupModel group = realm.getGroupById(groupId);
|
||||
|
||||
LOG.info(String.format("Getting Users from Group \"%s\" with ID %s", group.getName(), group.getId()));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue