Search in sources :

Example 6 with ProviderConfigProperty

use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.

the class PairwiseSubMapperHelper method createSectorIdentifierConfig.

public static ProviderConfigProperty createSectorIdentifierConfig() {
    ProviderConfigProperty property = new ProviderConfigProperty();
    property.setName(SECTOR_IDENTIFIER_URI);
    property.setType(ProviderConfigProperty.STRING_TYPE);
    property.setLabel(SECTOR_IDENTIFIER_URI_LABEL);
    property.setHelpText(SECTOR_IDENTIFIER_URI_HELP_TEXT);
    return property;
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty)

Example 7 with ProviderConfigProperty

use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.

the class PairwiseSubMapperHelper method createSaltConfig.

public static ProviderConfigProperty createSaltConfig() {
    ProviderConfigProperty property = new ProviderConfigProperty();
    property.setName(PAIRWISE_SUB_ALGORITHM_SALT);
    property.setType(ProviderConfigProperty.STRING_TYPE);
    property.setLabel(PAIRWISE_SUB_ALGORITHM_SALT_LABEL);
    property.setHelpText(PAIRWISE_SUB_ALGORITHM_SALT_HELP_TEXT);
    return property;
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty)

Example 8 with ProviderConfigProperty

use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.

the class ServerInfoAdminResource method setProviders.

private void setProviders(ServerInfoRepresentation info) {
    info.setComponentTypes(new HashMap<>());
    LinkedHashMap<String, SpiInfoRepresentation> spiReps = new LinkedHashMap<>();
    List<Spi> spis = new LinkedList<>(session.getKeycloakSessionFactory().getSpis());
    Collections.sort(spis, new Comparator<Spi>() {

        @Override
        public int compare(Spi s1, Spi s2) {
            return s1.getName().compareTo(s2.getName());
        }
    });
    for (Spi spi : spis) {
        SpiInfoRepresentation spiRep = new SpiInfoRepresentation();
        spiRep.setInternal(spi.isInternal());
        List<String> providerIds = new LinkedList<>(session.listProviderIds(spi.getProviderClass()));
        Collections.sort(providerIds);
        Map<String, ProviderRepresentation> providers = new HashMap<>();
        if (providerIds != null) {
            for (String name : providerIds) {
                ProviderRepresentation provider = new ProviderRepresentation();
                ProviderFactory<?> pi = session.getKeycloakSessionFactory().getProviderFactory(spi.getProviderClass(), name);
                provider.setOrder(pi.order());
                if (ServerInfoAwareProviderFactory.class.isAssignableFrom(pi.getClass())) {
                    provider.setOperationalInfo(((ServerInfoAwareProviderFactory) pi).getOperationalInfo());
                }
                if (pi instanceof ConfiguredProvider) {
                    ComponentTypeRepresentation rep = new ComponentTypeRepresentation();
                    rep.setId(pi.getId());
                    ConfiguredProvider configured = (ConfiguredProvider) pi;
                    rep.setHelpText(configured.getHelpText());
                    List<ProviderConfigProperty> configProperties = configured.getConfigProperties();
                    if (configProperties == null)
                        configProperties = Collections.EMPTY_LIST;
                    rep.setProperties(ModelToRepresentation.toRepresentation(configProperties));
                    if (pi instanceof ComponentFactory) {
                        rep.setMetadata(((ComponentFactory) pi).getTypeMetadata());
                    }
                    List<ComponentTypeRepresentation> reps = info.getComponentTypes().get(spi.getProviderClass().getName());
                    if (reps == null) {
                        reps = new LinkedList<>();
                        info.getComponentTypes().put(spi.getProviderClass().getName(), reps);
                    }
                    reps.add(rep);
                }
                providers.put(name, provider);
            }
        }
        spiRep.setProviders(providers);
        spiReps.put(spi.getName(), spiRep);
    }
    info.setProviders(spiReps);
}
Also used : SpiInfoRepresentation(org.keycloak.representations.info.SpiInfoRepresentation) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) ComponentFactory(org.keycloak.component.ComponentFactory) ProviderRepresentation(org.keycloak.representations.info.ProviderRepresentation) Spi(org.keycloak.provider.Spi) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) ConfiguredProvider(org.keycloak.provider.ConfiguredProvider) ComponentTypeRepresentation(org.keycloak.representations.idm.ComponentTypeRepresentation)

Example 9 with ProviderConfigProperty

use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.

the class ServerInfoAdminResource method toProtocolMapperTypeRepresentation.

private List<ProtocolMapperTypeRepresentation> toProtocolMapperTypeRepresentation(ProtocolMapper mapper) {
    ProtocolMapperTypeRepresentation rep = new ProtocolMapperTypeRepresentation();
    rep.setId(mapper.getId());
    rep.setName(mapper.getDisplayType());
    rep.setHelpText(mapper.getHelpText());
    rep.setCategory(mapper.getDisplayCategory());
    rep.setPriority(mapper.getPriority());
    List<ProviderConfigProperty> configProperties = mapper.getConfigProperties();
    rep.setProperties(ModelToRepresentation.toRepresentation(configProperties));
    return Arrays.asList(rep);
}
Also used : ProtocolMapperTypeRepresentation(org.keycloak.representations.idm.ProtocolMapperTypeRepresentation) ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty)

Example 10 with ProviderConfigProperty

use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.

the class ScriptBasedAuthenticatorFactory method getConfigProperties.

@Override
public List<ProviderConfigProperty> getConfigProperties() {
    ProviderConfigProperty name = new ProviderConfigProperty();
    name.setType(STRING_TYPE);
    name.setName(SCRIPT_NAME);
    name.setLabel("Script Name");
    name.setHelpText("The name of the script used to authenticate.");
    ProviderConfigProperty description = new ProviderConfigProperty();
    description.setType(STRING_TYPE);
    description.setName(SCRIPT_DESCRIPTION);
    description.setLabel("Script Description");
    description.setHelpText("The description of the script used to authenticate.");
    ProviderConfigProperty script = new ProviderConfigProperty();
    script.setType(SCRIPT_TYPE);
    script.setName(SCRIPT_CODE);
    script.setLabel("Script Source");
    String scriptTemplate = "//enter your script code here";
    try {
        scriptTemplate = StreamUtil.readString(getClass().getResourceAsStream("/scripts/authenticator-template.js"));
    } catch (IOException ioe) {
        LOGGER.warn(ioe);
    }
    script.setDefaultValue(scriptTemplate);
    script.setHelpText("The script used to authenticate. Scripts must at least define a function with the name 'authenticate(context)' that accepts a context (AuthenticationFlowContext) parameter.\n" + "This authenticator exposes the following additional variables: 'script', 'realm', 'user', 'session', 'authenticationSession', 'httpRequest', 'LOG'");
    return asList(name, description, script);
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) IOException(java.io.IOException)

Aggregations

ProviderConfigProperty (org.keycloak.provider.ProviderConfigProperty)30 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 ComponentFactory (org.keycloak.component.ComponentFactory)3 ComponentTypeRepresentation (org.keycloak.representations.idm.ComponentTypeRepresentation)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 NoCache (org.jboss.resteasy.annotations.cache.NoCache)2 MultivaluedHashMap (org.keycloak.common.util.MultivaluedHashMap)2 ConfigPropertyRepresentation (org.keycloak.representations.idm.ConfigPropertyRepresentation)2 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 NotFoundException (javax.ws.rs.NotFoundException)1 ConfigurableAuthenticatorFactory (org.keycloak.authentication.ConfigurableAuthenticatorFactory)1 SubComponentFactory (org.keycloak.component.SubComponentFactory)1 ConfiguredProvider (org.keycloak.provider.ConfiguredProvider)1