KeyCloak是否支持分页和用户列表的分类?

发布于 2025-02-11 23:34:28 字数 3160 浏览 1 评论 0原文

我正在使用Angular -Spring -boot -KeyCloak 16.0进行项目,其中一个要求是用户能够从KeyCloak分页,过滤和分类的用户属性中获取用户列表(ex。email,username,userName,userName,userName, ETC。)。

基于 keycloak的文档 =“ https://github.com/keycloak/keycloak/keycloak/blob/main/services/src/src/main/java/java/yorg/keycloak/keycloak/keycloak/services/services/resources/admin/admin/usersource.java github 可以进行过滤和分页,但是没有分类功能(结果似乎总是用用户名进行分类):

/**
 * Get users
 *
 * Returns a stream of users, filtered according to query parameters.
 *
 * @param search A String contained in username, first or last name, or email
 * @param last A String contained in lastName, or the complete lastName, if param "exact" is true
 * @param first A String contained in firstName, or the complete firstName, if param "exact" is true
 * @param email A String contained in email, or the complete email, if param "exact" is true
 * @param username A String contained in username, or the complete username, if param "exact" is true
 * @param emailVerified whether the email has been verified
 * @param idpAlias The alias of an Identity Provider linked to the user
 * @param idpUserId The userId at an Identity Provider linked to the user
 * @param firstResult Pagination offset
 * @param maxResults Maximum results size (defaults to 100)
 * @param enabled Boolean representing if user is enabled or not
 * @param briefRepresentation Boolean which defines whether brief representations are returned (default: false)
 * @param exact Boolean which defines whether the params "last", "first", "email" and "username" must match exactly
 * @param searchQuery A query to search for custom attributes, in the format 'key1:value2 key2:value2'
 * @return a non-null {@code Stream} of users
 */
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<UserRepresentation> getUsers(@QueryParam("search") String search,
                                           @QueryParam("lastName") String last,
                                           @QueryParam("firstName") String first,
                                           @QueryParam("email") String email,
                                           @QueryParam("username") String username,
                                           @QueryParam("emailVerified") Boolean emailVerified,
                                           @QueryParam("idpAlias") String idpAlias,
                                           @QueryParam("idpUserId") String idpUserId,
                                           @QueryParam("first") Integer firstResult,
                                           @QueryParam("max") Integer maxResults,
                                           @QueryParam("enabled") Boolean enabled,
                                           @QueryParam("briefRepresentation") Boolean briefRepresentation,
                                           @QueryParam("exact") Boolean exact,
                                           @QueryParam("q") String searchQuery)

我的问题是,我缺少某些东西吗?有没有人遇到同一个问题,他可以建议我一个可能的解决方案?

I'm working on a project using Angular - Spring boot - Keycloak 16.0 and one of the requirements is for the user to be able to fetch the user's list from Keycloak paginated, filtered and sorted by a user attribute (ex. email, username, etc.).

Based on Keycloak's documentation and by reading the source code on Github filtering and pagination is possible, but there's no sorting feature (the result seems always sorted by username):

/**
 * Get users
 *
 * Returns a stream of users, filtered according to query parameters.
 *
 * @param search A String contained in username, first or last name, or email
 * @param last A String contained in lastName, or the complete lastName, if param "exact" is true
 * @param first A String contained in firstName, or the complete firstName, if param "exact" is true
 * @param email A String contained in email, or the complete email, if param "exact" is true
 * @param username A String contained in username, or the complete username, if param "exact" is true
 * @param emailVerified whether the email has been verified
 * @param idpAlias The alias of an Identity Provider linked to the user
 * @param idpUserId The userId at an Identity Provider linked to the user
 * @param firstResult Pagination offset
 * @param maxResults Maximum results size (defaults to 100)
 * @param enabled Boolean representing if user is enabled or not
 * @param briefRepresentation Boolean which defines whether brief representations are returned (default: false)
 * @param exact Boolean which defines whether the params "last", "first", "email" and "username" must match exactly
 * @param searchQuery A query to search for custom attributes, in the format 'key1:value2 key2:value2'
 * @return a non-null {@code Stream} of users
 */
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<UserRepresentation> getUsers(@QueryParam("search") String search,
                                           @QueryParam("lastName") String last,
                                           @QueryParam("firstName") String first,
                                           @QueryParam("email") String email,
                                           @QueryParam("username") String username,
                                           @QueryParam("emailVerified") Boolean emailVerified,
                                           @QueryParam("idpAlias") String idpAlias,
                                           @QueryParam("idpUserId") String idpUserId,
                                           @QueryParam("first") Integer firstResult,
                                           @QueryParam("max") Integer maxResults,
                                           @QueryParam("enabled") Boolean enabled,
                                           @QueryParam("briefRepresentation") Boolean briefRepresentation,
                                           @QueryParam("exact") Boolean exact,
                                           @QueryParam("q") String searchQuery)

My question is, is there something that I'm missing? Has anyone run into the same problem who can suggest me a possible solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文