diff --git a/src/main/java/fr/insee/keycloak/keys/GeneratedRsaKeyFCProviderFactory.java b/src/main/java/fr/insee/keycloak/keys/GeneratedRsaKeyFCProviderFactory.java new file mode 100644 index 0000000..5e8a1be --- /dev/null +++ b/src/main/java/fr/insee/keycloak/keys/GeneratedRsaKeyFCProviderFactory.java @@ -0,0 +1,42 @@ +package fr.insee.keycloak.keys; + +import java.util.List; + + +import org.keycloak.crypto.Algorithm; +import org.keycloak.keys.AbstractRsaKeyProviderFactory; +import org.keycloak.keys.Attributes; +import org.keycloak.keys.GeneratedRsaKeyProviderFactory; +import org.keycloak.provider.ProviderConfigProperty; + +/** + * @author Stian Thorgersen + */ +public class GeneratedRsaKeyFCProviderFactory extends GeneratedRsaKeyProviderFactory { + + public static final String ID = "rsa-generated-fc+"; + + + + + private static ProviderConfigProperty RS_ALGORITHM_PROPERTY = new ProviderConfigProperty("algorithm", "Algorithm", + "Intended algorithm for the key", ProviderConfigProperty.LIST_TYPE, "RSA-OAEP", "RSA-OAEP"); + + private static final List CONFIG_PROPERTIES = AbstractRsaKeyProviderFactory.configurationBuilder() + .property(Attributes.KEY_SIZE_PROPERTY) + .property(Attributes.KEY_USE_PROPERTY) + .build(); + + @Override + public String getId() { + return ID; + } + + @Override + public List getConfigProperties() { + CONFIG_PROPERTIES.removeIf(p -> p.getName().equals("algorithm")); + CONFIG_PROPERTIES.add(RS_ALGORITHM_PROPERTY); + return CONFIG_PROPERTIES; + } + +} diff --git a/src/main/resources/META-INF/services/org.keycloak.keys.KeyProviderFactory b/src/main/resources/META-INF/services/org.keycloak.keys.KeyProviderFactory new file mode 100644 index 0000000..273026f --- /dev/null +++ b/src/main/resources/META-INF/services/org.keycloak.keys.KeyProviderFactory @@ -0,0 +1 @@ +fr.insee.keycloak.keys.GeneratedRsaKeyFCProviderFactory \ No newline at end of file