Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarative User Profile : Annotations & validator config as Json #705

Merged
merged 3 commits into from
Aug 30, 2022

Conversation

jermarchand
Copy link
Contributor

Hello,

In "Declarative User Profile", Annotations and Validators are not just map[string]string, it should be map[string]interface{}

In Terraform, an attribut (in a map) for a resource cannot be String or Object in the same time (Generics missing ;))

With this PR, the workaround I propose is to serialize the object as a Json string.

Hope this will help

Copy link
Contributor

@mrparkers mrparkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, when I use an object as a key for an annotation, like this:

    annotations = {
      bar = jsonencode({
        "hello" = "world"
      })
    }

it ends up looking like this on the keycloak side:

image

That doesn't seem right to me, is this something you'd expect?


c := make(map[string]interface{})
for k, v := range config {
if _, ok := v.([]interface{}); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that the validators that come bundled with Keycloak either have string or array keys (which is what we're checking for here), but do you think it would also be useful to handle nested objects? You mention that you have custom validators, do any of them use nested objects?

@daviddelannoy
Copy link
Contributor

Also, when I use an object as a key for an annotation, like this:

    annotations = {
      bar = jsonencode({
        "hello" = "world"
      })
    }

it ends up looking like this on the keycloak side:

image

That doesn't seem right to me, is this something you'd expect?

Hi @mrparkers
It seems OK to me, it is just a display limitation on Keycloak side, but we see it's an object and then can go to JSON editor to get more details ?

@nickej
Copy link

nickej commented Aug 19, 2022

Sorry for nagging but is there any progress on this one? We need to be able to create a profile attribute which have a list as validator configuration and an object as annotation. It is for a select input with given options.

Anything we can do to help out?

Thanks

Copy link
Contributor

@mrparkers mrparkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this PR, sorry for taking so long to get it merged.

@mrparkers mrparkers merged commit 0bd5e25 into keycloak:master Aug 30, 2022
@daviddelannoy
Copy link
Contributor

Hi @mrparkers

Do you plan to make a new tag soon ? We require this feature and would like to use it :)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants