[keycloak-user] How to store and search for (standardized?) user attributes?

Marko Strukelj mstrukel at redhat.com
Mon May 15 10:38:25 EDT 2017


There is a method for this:

https://github.com/keycloak/keycloak/blob/3.1.0.Final/server-spi/src/main/java/org/keycloak/storage/user/UserQueryProvider.java#L134-L148

But there is no Admin REST API through which it would be exposed.

You can add your custom REST endpoint and implement your custom search call
there.
See:

https://github.com/keycloak/keycloak/tree/3.1.0.Final/examples/providers/rest
for
example.

You'd have to make sure to protect your endpoint so its only accessible to
admin client. See how /users endpoint does this:

https://github.com/keycloak/keycloak/blob/3.1.0.Final/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java#L675



On Mon, May 15, 2017 at 3:44 PM, Guus der Kinderen <
guus.der.kinderen at gmail.com> wrote:

> *gently moves question back to the top of the mailinglist*
>
> On 2 May 2017 at 13:54, Guus der Kinderen <guus.der.kinderen at gmail.com>
> wrote:
>
> > Hi!
> >
> > We'd like to be able to store somewhat standard user attributes that
> > complete the email, first and last name values that Keycloak 'natively'
> > stores. Think of things like a date of birth, home/work address, phone
> > number, etc. Additionally, we'd like to be able to find users based on a
> > search query. We'd like to be able to answer questions like: "how many
> > users live in London?"
> >
> > So far, we've found the user attributes, where we could store this
> > information. That is a very generic solution though. Are there
> standardized
> > attribute names, profiles, that we can use?
> >
> > A further challenge is that we'd like to be able to query the user base,
> > based on attributes. We'd like to find people by address, by date of
> birth,
> > etc. The REST API does have search functionality, but it doesn't look
> like
> > you can find users by attribute value.
> >
> > Can anyone recommend a course of action here?
> >
> > Regards,
> >
> >    Guus
> >
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list