8000 Advanced query language to search for users · Issue #14478 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Advanced query language to search for users #14478

Open

Description

@nicolasiannarilli

Description

This enhancement would add a new way to create queries for searching users. By using a JSON description of the search criteria, one would be able to select complex queries. For example:

{"operator":"and","values":[
    {"operator":"equals","property":"username","value":"sjohn"}, 
    {"operator":"like","property":"firstName","value":"*jo*"}
]}

The following operators can be supported: AND, NOT, OR, LIKE, EQUALS, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUALS, LESS_THAN_OR_EQUALS

Discussion

https://groups.google.com/g/keycloak-dev/c/YOlCGmYjSg8

Motivation

Currently the search for users is very limited and sometimes confusing with a lot of differently named parameters ("q", "search", etc.). This feature would allow us to find users in a more accurate fashion.

This would also have the following benefits:

  • easier to parse and check query validity with json rules
  • translate to different providers languages (sql query, ldap)
  • supports a large set of operators
  • easier to extend: adding a new operator would only require a new implementation in each provider; without changing the api or interface

Details

I really think this could simplify user query code, using less methods. Also, more complex queries could possible.

I am currently finalizing a PR. Since it's my first time contributing to KeyCloak, I'm having some troubles with unit tests and finding my way in the codebase, but it should be ready pretty soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    Value

    None yet

    Effort

    None yet

    Votes

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0