use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.
the class NameIdMapperHelper method setConfigProperties.
public static void setConfigProperties(List<ProviderConfigProperty> configProperties) {
ProviderConfigProperty property = new ProviderConfigProperty();
property.setName(NameIdMapperHelper.MAPPER_NAMEID_FORMAT);
property.setLabel(NameIdMapperHelper.MAPPER_NAMEID_FORMAT_LABEL);
property.setHelpText(NameIdMapperHelper.MAPPER_NAMEID_FORMAT_HELP_TEXT);
List<String> types = new ArrayList<String>();
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_UNSPECIFIED.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_EMAIL.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_X509SUBJECTNAME.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_WINDOWS_DOMAIN_NAME.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_KERBEROS.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_ENTITY.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get());
types.add(JBossSAMLURIConstants.NAMEID_FORMAT_TRANSIENT.get());
property.setType(ProviderConfigProperty.LIST_TYPE);
property.setOptions(types);
configProperties.add(property);
}
use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.
the class StripSecretsUtils method strip.
public static ComponentRepresentation strip(KeycloakSession session, ComponentRepresentation rep) {
Map<String, ProviderConfigProperty> configProperties = ComponentUtil.getComponentConfigProperties(session, rep);
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();
}
}
return rep;
}
use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.
the class ComponentUtil method getComponentConfigProperties.
public static Map<String, ProviderConfigProperty> getComponentConfigProperties(KeycloakSession session, String providerType, String providerId) {
try {
ComponentFactory componentFactory = getComponentFactory(session, providerType, providerId);
List<ProviderConfigProperty> l = componentFactory.getConfigProperties();
Map<String, ProviderConfigProperty> properties = new HashMap<>();
for (ProviderConfigProperty p : l) {
properties.put(p.getName(), p);
}
List<ProviderConfigProperty> common = componentFactory.getCommonProviderConfigProperties();
for (ProviderConfigProperty p : common) {
properties.put(p.getName(), p);
}
return properties;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.
the class SetUserAttributeAuthenticatorFactory method getConfigProperties.
@Override
public List<ProviderConfigProperty> getConfigProperties() {
ProviderConfigProperty attributeName = new ProviderConfigProperty();
attributeName.setType(ProviderConfigProperty.STRING_TYPE);
attributeName.setName(CONF_ATTR_NAME);
attributeName.setLabel("Attribute name");
attributeName.setHelpText("Name of the user attribute to set");
ProviderConfigProperty attributeValue = new ProviderConfigProperty();
attributeValue.setType(ProviderConfigProperty.STRING_TYPE);
attributeValue.setName(CONF_ATTR_VALUE);
attributeValue.setLabel("Attribute value");
attributeValue.setHelpText("Value to set in the user attribute");
return Arrays.asList(attributeName, attributeValue);
}
use of org.keycloak.provider.ProviderConfigProperty in project keycloak by keycloak.
the class ClientRegistrationPolicyResource method getProviders.
/**
* Base path for retrieve providers with the configProperties properly filled
*
* @return
*/
@Path("providers")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<ComponentTypeRepresentation> getProviders() {
return session.getKeycloakSessionFactory().getProviderFactoriesStream(ClientRegistrationPolicy.class).map((ProviderFactory factory) -> {
ClientRegistrationPolicyFactory clientRegFactory = (ClientRegistrationPolicyFactory) factory;
List<ProviderConfigProperty> configProps = clientRegFactory.getConfigProperties(session);
ComponentTypeRepresentation rep = new ComponentTypeRepresentation();
rep.setId(clientRegFactory.getId());
rep.setHelpText(clientRegFactory.getHelpText());
rep.setProperties(ModelToRepresentation.toRepresentation(configProps));
return rep;
});
}
Aggregations