From 4b27e66714d44c84740edd47c437a6fc76273556 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Tue, 25 Oct 2016 08:52:02 +0200 Subject: [PATCH] KEYCLOAK-3782 Keysize for rsa-generated should be a dropdown --- .../org/keycloak/provider/ProviderConfigProperty.java | 10 ++++++++++ .../src/main/java/org/keycloak/keys/Attributes.java | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/server-spi/src/main/java/org/keycloak/provider/ProviderConfigProperty.java b/server-spi/src/main/java/org/keycloak/provider/ProviderConfigProperty.java index a6dbd77e91..c452e787a5 100755 --- a/server-spi/src/main/java/org/keycloak/provider/ProviderConfigProperty.java +++ b/server-spi/src/main/java/org/keycloak/provider/ProviderConfigProperty.java @@ -17,6 +17,7 @@ package org.keycloak.provider; +import java.util.Arrays; import java.util.List; /** @@ -62,6 +63,15 @@ public class ProviderConfigProperty { this.defaultValue = defaultValue; } + public ProviderConfigProperty(String name, String label, String helpText, String type, Object defaultValue, String... options) { + this.name = name; + this.label = label; + this.helpText = helpText; + this.type = type; + this.defaultValue = defaultValue; + this.options = Arrays.asList(options); + } + public ProviderConfigProperty(String name, String label, String helpText, String type, Object defaultValue, boolean secret) { this(name, label, helpText, type, defaultValue); this.secret = secret; diff --git a/services/src/main/java/org/keycloak/keys/Attributes.java b/services/src/main/java/org/keycloak/keys/Attributes.java index 758ec953fd..bc66dd34bd 100644 --- a/services/src/main/java/org/keycloak/keys/Attributes.java +++ b/services/src/main/java/org/keycloak/keys/Attributes.java @@ -19,9 +19,9 @@ package org.keycloak.keys; import org.keycloak.provider.ProviderConfigProperty; -import static org.keycloak.provider.ProviderConfigProperty.BOOLEAN_TYPE; -import static org.keycloak.provider.ProviderConfigProperty.FILE_TYPE; -import static org.keycloak.provider.ProviderConfigProperty.STRING_TYPE; +import java.util.LinkedList; + +import static org.keycloak.provider.ProviderConfigProperty.*; /** * @author Stian Thorgersen @@ -44,6 +44,6 @@ public interface Attributes { ProviderConfigProperty CERTIFICATE_PROPERTY = new ProviderConfigProperty(CERTIFICATE_KEY, "X509 Certificate", "X509 Certificate encoded in PEM format", FILE_TYPE, null); String KEY_SIZE_KEY = "keySize"; - ProviderConfigProperty KEY_SIZE_PROPERTY = new ProviderConfigProperty(KEY_SIZE_KEY, "Keysize", "Size for the generated keys (1024, 2048 or 4096)", STRING_TYPE, null); + ProviderConfigProperty KEY_SIZE_PROPERTY = new ProviderConfigProperty(KEY_SIZE_KEY, "Keysize", "Size for the generated keys (1024, 2048 or 4096)", LIST_TYPE, "2048", "1024", "2048", "4096"); }