new api, give all the users out
This commit is contained in:
parent
e3bf0b6421
commit
16793f1813
1 changed files with 5 additions and 2 deletions
|
@ -7,6 +7,10 @@ import jakarta.ws.rs.core.MediaType;
|
|||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import java.util.List;
|
||||
import org.keycloak.models.utils.ModelToRepresentation;
|
||||
import java.util.stream.*;
|
||||
|
||||
@Provider
|
||||
public class ApiKeyResource {
|
||||
|
@ -21,9 +25,8 @@ public class ApiKeyResource {
|
|||
@Produces("application/json")
|
||||
public List<UserRepresentation> checkApiKey(@QueryParam("apiKey") String apiKey) {
|
||||
var user = session.users().searchForUserByUserAttributeStream(session.getContext().getRealm(), "api-key", apiKey)
|
||||
.stream()
|
||||
.map(userModel -> ModelToRepresentation.toRepresentation(session, session.getContext().getRealm(), userModel))
|
||||
.collect(toList());
|
||||
.collect(Collectors.toList());
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue