Compare commits
1 commit
e4b4497b30
...
2a66027bea
| Author | SHA1 | Date | |
|---|---|---|---|
|
2a66027bea |
4 changed files with 14 additions and 6 deletions
|
|
@ -10,4 +10,4 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- ./ssh-key-provider/target/ssh-key-provider-1.0-SNAPSHOT.jar:/opt/keycloak/providers/ssh-key-provider.jar
|
- ./local-dev/providers/:/opt/keycloak/providers/
|
||||||
|
|
|
||||||
0
local-dev/.gitkeep
Normal file
0
local-dev/.gitkeep
Normal file
0
local-dev/providers/.gitkeep
Normal file
0
local-dev/providers/.gitkeep
Normal file
|
|
@ -6,7 +6,6 @@ import java.util.stream.Stream;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import jakarta.ws.rs.PathParam;
|
|
||||||
import jakarta.ws.rs.Produces;
|
import jakarta.ws.rs.Produces;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
|
|
@ -36,9 +35,19 @@ public class SSHKeyResourceProvider implements RealmResourceProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("export/{group_id}")
|
@Path("hello")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response exportKeys(@PathParam("group_id") String groupId) {
|
@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() {
|
||||||
UserProvider userProvider = session.users();
|
UserProvider userProvider = session.users();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -46,8 +55,7 @@ public class SSHKeyResourceProvider implements RealmResourceProvider {
|
||||||
authResult -> authResult.getToken().getIssuedFor().equals("admin-cli"));
|
authResult -> authResult.getToken().getIssuedFor().equals("admin-cli"));
|
||||||
|
|
||||||
RealmModel realm = session.getContext().getRealm();
|
RealmModel realm = session.getContext().getRealm();
|
||||||
// TODO: add allowlist check
|
GroupModel group = realm.getGroupById("fbf5f78b-d2be-49dd-b04f-11a5e8ee583f");
|
||||||
GroupModel group = realm.getGroupById(groupId);
|
|
||||||
|
|
||||||
LOG.info(String.format("Getting Users from Group \"%s\" with ID %s", group.getName(), group.getId()));
|
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