Java Code Examples for org.keycloak.provider.ProviderConfigProperty#setOptions()

The following examples show how to use org.keycloak.provider.ProviderConfigProperty#setOptions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OIDCAttributeMapperHelper.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public static void addJsonTypeConfig(List<ProviderConfigProperty> configProperties) {
    ProviderConfigProperty property = new ProviderConfigProperty();
    property.setName(JSON_TYPE);
    property.setLabel(JSON_TYPE);
    List<String> types = new ArrayList(5);
    types.add("String");
    types.add("long");
    types.add("int");
    types.add("boolean");
    types.add("JSON");
    property.setType(ProviderConfigProperty.LIST_TYPE);
    property.setOptions(types);
    property.setHelpText(JSON_TYPE_TOOLTIP);
    configProperties.add(property);
}
 
Example 2
Source File: AbstractLDAPStorageMapperFactory.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public static ProviderConfigProperty createConfigProperty(String name, String label, String helpText, String type, List<String> options) {
    ProviderConfigProperty configProperty = new ProviderConfigProperty();
    configProperty.setName(name);
    configProperty.setLabel(label);
    configProperty.setHelpText(helpText);
    configProperty.setType(type);
    configProperty.setOptions(options);
    return configProperty;
}
 
Example 3
Source File: ConditionalOtpFormAuthenticatorFactory.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public List<ProviderConfigProperty> getConfigProperties() {

    ProviderConfigProperty forceOtpUserAttribute = new ProviderConfigProperty();
    forceOtpUserAttribute.setType(STRING_TYPE);
    forceOtpUserAttribute.setName(OTP_CONTROL_USER_ATTRIBUTE);
    forceOtpUserAttribute.setLabel("OTP control User Attribute");
    forceOtpUserAttribute.setHelpText("The name of the user attribute to explicitly control OTP auth. " +
            "If attribute value is 'force' then OTP is always required. " +
            "If value is 'skip' the OTP auth is skipped. Otherwise this check is ignored.");

    ProviderConfigProperty skipOtpRole = new ProviderConfigProperty();
    skipOtpRole.setType(ROLE_TYPE);
    skipOtpRole.setName(SKIP_OTP_ROLE);
    skipOtpRole.setLabel("Skip OTP for Role");
    skipOtpRole.setHelpText("OTP is always skipped if user has the given Role.");

    ProviderConfigProperty forceOtpRole = new ProviderConfigProperty();
    forceOtpRole.setType(ROLE_TYPE);
    forceOtpRole.setName(FORCE_OTP_ROLE);
    forceOtpRole.setLabel("Force OTP for Role");
    forceOtpRole.setHelpText("OTP is always required if user has the given Role.");

    ProviderConfigProperty skipOtpForHttpHeader = new ProviderConfigProperty();
    skipOtpForHttpHeader.setType(STRING_TYPE);
    skipOtpForHttpHeader.setName(SKIP_OTP_FOR_HTTP_HEADER);
    skipOtpForHttpHeader.setLabel("Skip OTP for Header");
    skipOtpForHttpHeader.setHelpText("OTP is skipped if a HTTP request header does matches the given pattern." +
            "Can be used to specify trusted networks via: X-Forwarded-Host: (1.2.3.4|1.2.3.5)." +
            "In this case requests from 1.2.3.4 and 1.2.3.5 come from a trusted source.");
    skipOtpForHttpHeader.setDefaultValue("");

    ProviderConfigProperty forceOtpForHttpHeader = new ProviderConfigProperty();
    forceOtpForHttpHeader.setType(STRING_TYPE);
    forceOtpForHttpHeader.setName(FORCE_OTP_FOR_HTTP_HEADER);
    forceOtpForHttpHeader.setLabel("Force OTP for Header");
    forceOtpForHttpHeader.setHelpText("OTP required if a HTTP request header matches the given pattern.");
    forceOtpForHttpHeader.setDefaultValue("");

    ProviderConfigProperty defaultOutcome = new ProviderConfigProperty();
    defaultOutcome.setType(LIST_TYPE);
    defaultOutcome.setName(DEFAULT_OTP_OUTCOME);
    defaultOutcome.setLabel("Fallback OTP handling");
    defaultOutcome.setOptions(asList(SKIP, FORCE));
    defaultOutcome.setHelpText("What to do in case of every check abstains. Defaults to force OTP authentication.");

    return asList(forceOtpUserAttribute, skipOtpRole, forceOtpRole, skipOtpForHttpHeader, forceOtpForHttpHeader, defaultOutcome);
}