Search in sources :

Example 1 with SubComponentFactory

use of org.keycloak.component.SubComponentFactory in project keycloak by keycloak.

the class ComponentResource method toComponentTypeRepresentation.

private ComponentTypeRepresentation toComponentTypeRepresentation(ProviderFactory factory, ComponentModel parent) {
    ComponentTypeRepresentation rep = new ComponentTypeRepresentation();
    rep.setId(factory.getId());
    ComponentFactory componentFactory = (ComponentFactory) factory;
    rep.setHelpText(componentFactory.getHelpText());
    List<ProviderConfigProperty> props;
    Map<String, Object> metadata;
    if (factory instanceof SubComponentFactory) {
        props = ((SubComponentFactory) factory).getConfigProperties(realm, parent);
        metadata = ((SubComponentFactory) factory).getTypeMetadata(realm, parent);
    } else {
        props = componentFactory.getConfigProperties();
        metadata = componentFactory.getTypeMetadata();
    }
    List<ConfigPropertyRepresentation> propReps = ModelToRepresentation.toRepresentation(props);
    rep.setProperties(propReps);
    rep.setMetadata(metadata);
    return rep;
}
Also used : ComponentTypeRepresentation(org.keycloak.representations.idm.ComponentTypeRepresentation) SubComponentFactory(org.keycloak.component.SubComponentFactory) SubComponentFactory(org.keycloak.component.SubComponentFactory) ComponentFactory(org.keycloak.component.ComponentFactory) ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) ConfigPropertyRepresentation(org.keycloak.representations.idm.ConfigPropertyRepresentation)

Aggregations

ComponentFactory (org.keycloak.component.ComponentFactory)1 SubComponentFactory (org.keycloak.component.SubComponentFactory)1 ProviderConfigProperty (org.keycloak.provider.ProviderConfigProperty)1 ComponentTypeRepresentation (org.keycloak.representations.idm.ComponentTypeRepresentation)1 ConfigPropertyRepresentation (org.keycloak.representations.idm.ConfigPropertyRepresentation)1