Search in sources :

Example 26 with ProviderConfigProperty

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

the class ConditionalRoleAuthenticatorFactory method getConfigProperties.

@Override
public List<ProviderConfigProperty> getConfigProperties() {
    ProviderConfigProperty role = new ProviderConfigProperty();
    role.setType(ProviderConfigProperty.ROLE_TYPE);
    role.setName(CONDITIONAL_USER_ROLE);
    role.setLabel("User role");
    role.setHelpText("Role the user should have to execute this flow. Click 'Select Role' button to browse roles, or just type it in the textbox. To reference a client role the syntax is clientname.clientrole, i.e. myclient.myrole");
    ProviderConfigProperty negateOutput = new ProviderConfigProperty();
    negateOutput.setType(ProviderConfigProperty.BOOLEAN_TYPE);
    negateOutput.setName(CONF_NEGATE);
    negateOutput.setLabel("Negate output");
    negateOutput.setHelpText("Apply a NOT to the check result. When this is true, then the condition will evaluate to true just if user does NOT have the specified role. When this is false, the condition will evaluate to true just if user has the specified role");
    return Arrays.asList(role, negateOutput);
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty)

Example 27 with ProviderConfigProperty

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

the class StripSecretsUtils method strip.

public static ComponentExportRepresentation strip(KeycloakSession session, String providerType, ComponentExportRepresentation rep) {
    Map<String, ProviderConfigProperty> configProperties = ComponentUtil.getComponentConfigProperties(session, providerType, rep.getProviderId());
    if (rep.getConfig() == null) {
        return rep;
    }
    Iterator<Map.Entry<String, List<String>>> itr = rep.getConfig().entrySet().iterator();
    while (itr.hasNext()) {
        Map.Entry<String, List<String>> next = itr.next();
        ProviderConfigProperty configProperty = configProperties.get(next.getKey());
        if (configProperty != null) {
            if (configProperty.isSecret()) {
                if (next.getValue() == null || next.getValue().isEmpty()) {
                    next.setValue(Collections.singletonList(ComponentRepresentation.SECRET_VALUE));
                } else {
                    next.setValue(next.getValue().stream().map(StripSecretsUtils::maskNonVaultValue).collect(Collectors.toList()));
                }
            }
        } else {
            itr.remove();
        }
    }
    MultivaluedHashMap<String, ComponentExportRepresentation> sub = rep.getSubComponents();
    for (Map.Entry<String, List<ComponentExportRepresentation>> ent : sub.entrySet()) {
        for (ComponentExportRepresentation c : ent.getValue()) {
            strip(session, ent.getKey(), c);
        }
    }
    return rep;
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) ComponentExportRepresentation(org.keycloak.representations.idm.ComponentExportRepresentation) List(java.util.List) Map(java.util.Map) MultivaluedHashMap(org.keycloak.common.util.MultivaluedHashMap)

Example 28 with ProviderConfigProperty

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

the class ModelToRepresentation method toRepresentation.

public static List<ConfigPropertyRepresentation> toRepresentation(List<ProviderConfigProperty> configProperties) {
    List<ConfigPropertyRepresentation> propertiesRep = new LinkedList<>();
    for (ProviderConfigProperty prop : configProperties) {
        ConfigPropertyRepresentation propRep = toRepresentation(prop);
        propertiesRep.add(propRep);
    }
    return propertiesRep;
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) LinkedList(java.util.LinkedList)

Example 29 with ProviderConfigProperty

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

the class AttributeStatementHelper method setConfigProperties.

public static void setConfigProperties(List<ProviderConfigProperty> configProperties) {
    ProviderConfigProperty property = new ProviderConfigProperty();
    property.setName(AttributeStatementHelper.FRIENDLY_NAME);
    property.setLabel(AttributeStatementHelper.FRIENDLY_NAME_LABEL);
    property.setHelpText(AttributeStatementHelper.FRIENDLY_NAME_HELP_TEXT);
    configProperties.add(property);
    property = new ProviderConfigProperty();
    property.setName(AttributeStatementHelper.SAML_ATTRIBUTE_NAME);
    property.setLabel("SAML Attribute Name");
    property.setHelpText("SAML Attribute Name");
    configProperties.add(property);
    property = new ProviderConfigProperty();
    property.setName(AttributeStatementHelper.SAML_ATTRIBUTE_NAMEFORMAT);
    property.setLabel("SAML Attribute NameFormat");
    property.setHelpText("SAML Attribute NameFormat.  Can be basic, URI reference, or unspecified.");
    List<String> types = new ArrayList<>(3);
    types.add(AttributeStatementHelper.BASIC);
    types.add(AttributeStatementHelper.URI_REFERENCE);
    types.add(AttributeStatementHelper.UNSPECIFIED);
    property.setType(ProviderConfigProperty.LIST_TYPE);
    property.setOptions(types);
    configProperties.add(property);
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty) ArrayList(java.util.ArrayList)

Example 30 with ProviderConfigProperty

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

the class SecureClientAuthenticatorExecutorFactory method postInit.

@Override
public void postInit(KeycloakSessionFactory factory) {
    List<String> clientAuthProviders = factory.getProviderFactoriesStream(ClientAuthenticator.class).map(ProviderFactory::getId).collect(Collectors.toList());
    ProviderConfigProperty allowedClientAuthenticatorsProperty = new ProviderConfigProperty(ALLOWED_CLIENT_AUTHENTICATORS, "Allowed Client Authenticators", "List of available client authentication methods, which are allowed for clients to use. Other client authentication methods will not be allowed.", ProviderConfigProperty.MULTIVALUED_LIST_TYPE, null);
    allowedClientAuthenticatorsProperty.setOptions(clientAuthProviders);
    ProviderConfigProperty autoConfiguredClientAuthenticator = new ProviderConfigProperty(DEFAULT_CLIENT_AUTHENTICATOR, "Default Client Authenticator", "This client authentication method will be set as the authentication method to new clients during register/update request of the client in case that client does not have explicitly set other client authenticator method. If it is not set, then the client authenticator won't be set on new clients. Regardless the value of this option, client is still always validated to match with any of the allowed client authentication methods", ProviderConfigProperty.LIST_TYPE, JWTClientAuthenticator.PROVIDER_ID);
    autoConfiguredClientAuthenticator.setOptions(clientAuthProviders);
    configProperties = Arrays.asList(allowedClientAuthenticatorsProperty, autoConfiguredClientAuthenticator);
}
Also used : ProviderConfigProperty(org.keycloak.provider.ProviderConfigProperty)

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