Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

AIMSConfig does not support credentials and redirectRewriteRules configuration #255

Description

@drndos

Problem:
AIMSConfig contains method initAdapterConfig that is using reflection to setup keycloak Adapter configuration based on Spring environment.
Currently it supports only setting String values and boolean values
That means that when I need to set the keycloak secret in credentials map it is impossible in current implementation.
Solution:
Add code to support Map type in AIMSConfig or rewrite the environment system for keycloak configuration entirely.

After line 128:

                        else if (method.getParameterTypes()[0] == boolean.class)
                        {
                            method.invoke(this.adapterConfig, Boolean.parseBoolean(value));
                        }

there could be something like this:

                        else if (method.getParameterTypes()[0] == Map.class)
                        {
                            Map<String, String> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
                            String[] entries = value.split(",");
                            for(String entry: entries){
                                String[] keyValue = entry.split(":");
                                map.put(keyValue[0],keyValue[1]);
                            }
                            method.invoke(this.adapterConfig, map);
                        }

Then setting like -Daims.credentials=secret:1234567-1234-1234-1234-123456789 will be possible to configure keycloak secret in confidential setup.

Both the current solution and proposed solution seem hacky. Maybe refactoring of current implementation is needed.

Thank you,
Filip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions