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);
}
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;
}
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;
}
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);
}
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);
}
Aggregations