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

AIMSConfig does not support credentials and redirectRewriteRules configuration #255

Open
drndos opened this issue Jul 24, 2020 · 0 comments

Comments

@drndos
Copy link

drndos commented Jul 24, 2020

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

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

No branches or pull requests

1 participant