Search in sources :

Example 1 with CollapsibleLayout

use of pl.edu.icm.unity.webui.common.CollapsibleLayout in project unity by unity-idm.

the class OAuthEditorGeneralTab method buildScopesSection.

private CollapsibleLayout buildScopesSection() {
    VerticalLayout scopesLayout = new VerticalLayout();
    scopesLayout.setMargin(false);
    scopesGrid = new GridWithEditorInDetails<>(msg, OAuthScope.class, () -> new ScopeEditor(msg, attrTypes), s -> false, s -> s != null && s.getName() != null && (SCOPES_BLOCKED_TO_EDIT.contains(s.getName())), true);
    scopesGrid.addGotoEditColumn(s -> s.getName(), msg.getMessage("OAuthEditorGeneralTab.scopeName"), 10);
    scopesGrid.addTextColumn(s -> s.getDescription(), msg.getMessage("OAuthEditorGeneralTab.scopeDescription"), 10);
    scopesGrid.addTextColumn(s -> s.getAttributes() != null ? String.join(",", s.getAttributes()) : "", msg.getMessage("OAuthEditorGeneralTab.scopeAttributes"), 10);
    scopesGrid.setMinHeightByRow(7);
    configBinder.forField(scopesGrid).bind("scopes");
    scopesLayout.addComponent(scopesGrid);
    return new CollapsibleLayout(msg.getMessage("OAuthEditorGeneralTab.scopes"), scopesLayout);
}
Also used : CustomComponent(com.vaadin.ui.CustomComponent) TextField(com.vaadin.ui.TextField) NoSpaceValidator(pl.edu.icm.unity.webui.common.validators.NoSpaceValidator) OutputTranslationProfileFieldFactory(io.imunity.webconsole.utils.tprofile.OutputTranslationProfileFieldFactory) GridWithEditorInDetails(pl.edu.icm.unity.webui.common.GridWithEditorInDetails) CheckBox(com.vaadin.ui.CheckBox) EditorTab(pl.edu.icm.unity.webui.console.services.ServiceEditorBase.EditorTab) Page(com.vaadin.server.Page) DefaultServiceDefinition(pl.edu.icm.unity.webui.console.services.DefaultServiceDefinition) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) ServiceEditorTab(pl.edu.icm.unity.webui.console.services.ServiceEditorComponent.ServiceEditorTab) ImmutableSet(com.google.common.collect.ImmutableSet) Family(com.nimbusds.jose.JWSAlgorithm.Family) OAuthTokenEndpoint(pl.edu.icm.unity.oauth.as.token.OAuthTokenEndpoint) RefreshTokenIssuePolicy(pl.edu.icm.unity.oauth.as.OAuthASProperties.RefreshTokenIssuePolicy) Collection(java.util.Collection) Set(java.util.Set) JWSAlgorithm(com.nimbusds.jose.JWSAlgorithm) OIDCScopeValue(com.nimbusds.openid.connect.sdk.OIDCScopeValue) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) Collectors(java.util.stream.Collectors) Binder(com.vaadin.data.Binder) StandardCharsets(java.nio.charset.StandardCharsets) MarginInfo(com.vaadin.shared.ui.MarginInfo) SigningAlgorithms(pl.edu.icm.unity.oauth.as.OAuthASProperties.SigningAlgorithms) Images(pl.edu.icm.unity.webui.common.Images) List(java.util.List) ChipsWithFreeText(pl.edu.icm.unity.webui.common.chips.ChipsWithFreeText) Styles(pl.edu.icm.unity.webui.common.Styles) IntStepper(org.vaadin.risto.stepper.IntStepper) FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) ValidationResult(com.vaadin.data.ValidationResult) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) IdentityType(pl.edu.icm.unity.types.basic.IdentityType) Label(com.vaadin.ui.Label) AccessTokenFormat(pl.edu.icm.unity.oauth.as.OAuthASProperties.AccessTokenFormat) EmbeddedEditor(pl.edu.icm.unity.webui.common.GridWithEditorInDetails.EmbeddedEditor) OAuthAuthzWebEndpoint(pl.edu.icm.unity.oauth.as.webauthz.OAuthAuthzWebEndpoint) TooltipExtension(io.imunity.tooltip.TooltipExtension) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) WrongArgumentException(pl.edu.icm.unity.exceptions.WrongArgumentException) ValueChangeListener(com.vaadin.data.HasValue.ValueChangeListener) EndpointPathValidator(pl.edu.icm.unity.engine.api.endpoint.EndpointPathValidator) Button(com.vaadin.ui.Button) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FormLayout(com.vaadin.ui.FormLayout) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 2 with CollapsibleLayout

use of pl.edu.icm.unity.webui.common.CollapsibleLayout in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildOtpHeaderSection.

private CollapsibleLayout buildOtpHeaderSection() {
    FormLayoutWithFixedCaptionWidth otp = new FormLayoutWithFixedCaptionWidth();
    ComboBox<Integer> codeLength = new ComboBox<>(msg.getMessage("OTPCredentialDefinitionEditor.codeLength"));
    tooltip(codeLength, msg.getMessage("OTPWithLDAPAuthenticatorEditor.codeLength.tip"));
    codeLength.setItems(6, 8);
    codeLength.setEmptySelectionAllowed(false);
    configBinder.forField(codeLength).asRequired().bind("codeLength");
    otp.addComponent(codeLength);
    IntStepper allowedTimeDrift = new IntStepper(msg.getMessage("OTPWithLDAPAuthenticatorEditor.allowedTimeDrift"));
    tooltip(allowedTimeDrift, msg.getMessage("OTPWithLDAPAuthenticatorEditor.allowedTimeDrift.tip"));
    allowedTimeDrift.setWidth(3, Unit.EM);
    allowedTimeDrift.setMinValue(0);
    allowedTimeDrift.setMaxValue(2880);
    configBinder.forField(allowedTimeDrift).asRequired().bind("allowedTimeDriftSteps");
    otp.addComponent(allowedTimeDrift);
    IntStepper timeStep = new IntStepper(msg.getMessage("OTPWithLDAPAuthenticatorEditor.timeStep"));
    tooltip(timeStep, msg.getMessage("OTPWithLDAPAuthenticatorEditor.timeStep.tip"));
    timeStep.setWidth(3, Unit.EM);
    timeStep.setMinValue(5);
    timeStep.setMaxValue(180);
    configBinder.forField(timeStep).asRequired().bind("timeStepSeconds");
    otp.addComponent(timeStep);
    EnumComboBox<HashFunction> hashAlgorithm = new EnumComboBox<>(msg.getMessage("OTPWithLDAPAuthenticatorEditor.hashAlgorithm"), msg, "OTPWithLDAPAuthenticatorEditor.hashAlgorithm.", HashFunction.class, HashFunction.SHA1);
    tooltip(hashAlgorithm, msg.getMessage("OTPWithLDAPAuthenticatorEditor.hashAlgorithm.tip"));
    configBinder.forField(hashAlgorithm).asRequired().bind("hashFunction");
    otp.addComponent(hashAlgorithm);
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.otp"), otp);
}
Also used : CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) HashFunction(io.imunity.otp.HashFunction) ComboBox(com.vaadin.ui.ComboBox) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) IntStepper(org.vaadin.risto.stepper.IntStepper)

Example 3 with CollapsibleLayout

use of pl.edu.icm.unity.webui.common.CollapsibleLayout in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildUserDNResolvingSection.

private CollapsibleLayout buildUserDNResolvingSection() {
    FormLayoutWithFixedCaptionWidth userDNResolvingLayout = new FormLayoutWithFixedCaptionWidth();
    userDNResolvingLayout.setMargin(false);
    userDNResolvingMode = new RadioButtonGroup<>();
    userDNResolvingMode.setItemCaptionGenerator(v -> msg.getMessage("LdapAuthenticatorEditor.userDNResolvingMode." + v.toString()));
    userDNResolvingMode.setItems(UserDNResolving.values());
    configBinder.forField(userDNResolvingMode).bind("userDNResolving");
    userDNResolvingLayout.addComponent(userDNResolvingMode);
    TextField userDNtemplate = new TextField(msg.getMessage("LdapAuthenticatorEditor.userDNtemplate"));
    userDNtemplate.setPlaceholder("uid={USERNAME},dc=myorg,dc=global");
    userDNtemplate.setDescription(msg.getMessage("LdapAuthenticatorEditor.userDNtemplate.desc"));
    userDNtemplate.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(userDNtemplate).withValidator((v, c) -> {
        if (v != null && v.contains("{USERNAME}") || !userDNResolvingMode.getValue().equals(UserDNResolving.template)) {
            return ValidationResult.ok();
        } else {
            return ValidationResult.error(msg.getMessage("LdapAuthenticatorEditor.invalidUserDNtemplate"));
        }
    }).bind("userDNTemplate");
    userDNResolvingLayout.addComponent(userDNtemplate);
    TextField ldapSearchBaseName = new TextField(msg.getMessage("LdapAuthenticatorEditor.searchSpecification.baseName"));
    ldapSearchBaseName.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(ldapSearchBaseName).asRequired(getLdapSearchRequiredValidator()).bind("ldapSearchBaseName");
    userDNResolvingLayout.addComponent(ldapSearchBaseName);
    TextField ldapSearchFilter = new TextField(msg.getMessage("LdapAuthenticatorEditor.searchSpecification.filter"));
    ldapSearchFilter.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(ldapSearchFilter).withValidator((v, c) -> {
        if (userDNResolvingMode.getValue().equals(UserDNResolving.ldapSearch)) {
            return getFilterValidator().apply(v, c);
        } else {
            return ValidationResult.ok();
        }
    }).bind("ldapSearchFilter");
    userDNResolvingLayout.addComponent(ldapSearchFilter);
    ComboBox<SearchScope> ldapSearchScope = new ComboBox<>(msg.getMessage("LdapAuthenticatorEditor.searchSpecification.scope"));
    ldapSearchScope.setEmptySelectionAllowed(false);
    ldapSearchScope.setItems(SearchScope.values());
    configBinder.forField(ldapSearchScope).bind("ldapSearchScope");
    userDNResolvingLayout.addComponent(ldapSearchScope);
    userDNResolvingMode.addValueChangeListener(e -> {
        UserDNResolving v = userDNResolvingMode.getValue();
        userDNtemplate.setVisible(v.equals(UserDNResolving.template));
        ldapSearchBaseName.setVisible(v.equals(UserDNResolving.ldapSearch));
        ldapSearchFilter.setVisible(v.equals(UserDNResolving.ldapSearch));
        ldapSearchScope.setVisible(v.equals(UserDNResolving.ldapSearch));
        if (v.equals(UserDNResolving.template)) {
            ldapSearchBaseName.clear();
            ldapSearchFilter.clear();
        } else {
            userDNtemplate.clear();
        }
    });
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.userDNResolving"), userDNResolvingLayout);
}
Also used : FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) Autowired(org.springframework.beans.factory.annotation.Autowired) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) Validator(com.vaadin.data.Validator) CheckBox(com.vaadin.ui.CheckBox) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) TooltipExtension.tooltip(io.imunity.tooltip.TooltipExtension.tooltip) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Set(java.util.Set) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) Binder(com.vaadin.data.Binder) HashFunction(io.imunity.otp.HashFunction) EngineException(pl.edu.icm.unity.exceptions.EngineException) ObjectFactory(org.springframework.beans.factory.ObjectFactory) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) RadioButtonGroup(com.vaadin.ui.RadioButtonGroup) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Optional(java.util.Optional) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Filter(com.unboundid.ldap.sdk.Filter) Unit(com.vaadin.server.Sizeable.Unit) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) ComboBox(com.vaadin.ui.ComboBox) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving)

Example 4 with CollapsibleLayout

use of pl.edu.icm.unity.webui.common.CollapsibleLayout in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildServersConnectionConfigurationSection.

private CollapsibleLayout buildServersConnectionConfigurationSection() {
    FormLayoutWithFixedCaptionWidth serverConnectionLayout = new FormLayoutWithFixedCaptionWidth();
    serverConnectionLayout.setMargin(false);
    GridWithEditor<ServerSpecification> serverConfig = new GridWithEditor<>(msg, ServerSpecification.class);
    serverConnectionLayout.addComponent(serverConfig);
    serverConfig.addTextColumn(s -> s.getServer(), (t, v) -> t.setServer(v), msg.getMessage("LdapAuthenticatorEditor.server"), 40, true);
    serverConfig.addIntColumn(s -> s.getPort(), (t, v) -> t.setPort(v), msg.getMessage("LdapAuthenticatorEditor.port"), 10, Optional.of(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 1, 65535)));
    serverConfig.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(serverConfig).withValidator((v, c) -> {
        if (v == null || v.isEmpty()) {
            return ValidationResult.error(msg.getMessage("fieldRequired"));
        } else {
            return ValidationResult.ok();
        }
    }).bind("servers");
    ComboBox<ConnectionMode> connectionMode = new ComboBox<>(msg.getMessage("LdapAuthenticatorEditor.connectionMode"));
    connectionMode.setItems(ConnectionMode.values());
    connectionMode.setEmptySelectionAllowed(false);
    configBinder.forField(connectionMode).bind("connectionMode");
    serverConnectionLayout.addComponent(connectionMode);
    TextField followReferrals = new TextField(msg.getMessage("LdapAuthenticatorEditor.followReferrals"));
    configBinder.forField(followReferrals).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("followReferrals");
    serverConnectionLayout.addComponent(followReferrals);
    TextField searchTimeLimit = new TextField(msg.getMessage("LdapAuthenticatorEditor.searchTimeLimit"));
    configBinder.forField(searchTimeLimit).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("searchTimeLimit");
    serverConnectionLayout.addComponent(searchTimeLimit);
    TextField socketTimeout = new TextField(msg.getMessage("LdapAuthenticatorEditor.socketTimeout"));
    configBinder.forField(socketTimeout).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("socketTimeout");
    serverConnectionLayout.addComponent(socketTimeout);
    CheckBox trustAllCerts = new CheckBox(msg.getMessage("LdapAuthenticatorEditor.trustAllCerts"));
    configBinder.forField(trustAllCerts).bind("trustAllCerts");
    serverConnectionLayout.addComponent(trustAllCerts);
    ComboBox<String> clientTrustStore = new ComboBox<>(msg.getMessage("LdapAuthenticatorEditor.clientTrustStore"));
    clientTrustStore.setItems(validators);
    configBinder.forField(clientTrustStore).bind("clientTrustStore");
    serverConnectionLayout.addComponent(clientTrustStore);
    trustAllCerts.addValueChangeListener(e -> {
        clientTrustStore.setEnabled(!e.getValue());
    });
    TextField resultEntriesLimit = new TextField(msg.getMessage("LdapAuthenticatorEditor.resultEntriesLimit"));
    configBinder.forField(resultEntriesLimit).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("resultEntriesLimit");
    serverConnectionLayout.addComponent(resultEntriesLimit);
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.serverConnectionConfiguration"), serverConnectionLayout);
}
Also used : IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) Autowired(org.springframework.beans.factory.annotation.Autowired) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) Validator(com.vaadin.data.Validator) CheckBox(com.vaadin.ui.CheckBox) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) TooltipExtension.tooltip(io.imunity.tooltip.TooltipExtension.tooltip) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Set(java.util.Set) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) Binder(com.vaadin.data.Binder) HashFunction(io.imunity.otp.HashFunction) EngineException(pl.edu.icm.unity.exceptions.EngineException) ObjectFactory(org.springframework.beans.factory.ObjectFactory) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) RadioButtonGroup(com.vaadin.ui.RadioButtonGroup) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Optional(java.util.Optional) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Filter(com.unboundid.ldap.sdk.Filter) Unit(com.vaadin.server.Sizeable.Unit) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) ComboBox(com.vaadin.ui.ComboBox) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) CheckBox(com.vaadin.ui.CheckBox) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter)

Example 5 with CollapsibleLayout

use of pl.edu.icm.unity.webui.common.CollapsibleLayout in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildLdapHeaderSection.

private CollapsibleLayout buildLdapHeaderSection() {
    FormLayoutWithFixedCaptionWidth ldap = new FormLayoutWithFixedCaptionWidth();
    TextField systemDN = new TextField(msg.getMessage("LdapAuthenticatorEditor.systemDN"));
    systemDN.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(systemDN).asRequired().bind("systemDN");
    ldap.addComponent(systemDN);
    TextField systemPassword = new TextField(msg.getMessage("LdapAuthenticatorEditor.systemPassword"));
    systemPassword.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(systemPassword).asRequired().bind("systemPassword");
    ldap.addComponent(systemPassword);
    TextField validUserFilter = new TextField(msg.getMessage("LdapAuthenticatorEditor.validUserFilter"));
    validUserFilter.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(validUserFilter).withValidator((v, c) -> {
        try {
            Filter.create(v);
        } catch (LDAPException e) {
            return ValidationResult.error(msg.getMessage("LdapAuthenticatorEditor.invalidValidUserFilter"));
        }
        return ValidationResult.ok();
    }).bind("validUserFilter");
    ldap.addComponent(validUserFilter);
    TextField secretAttribute = new TextField(msg.getMessage("OTPWithLDAPAuthenticatorEditor.secretAttribute"));
    configBinder.forField(secretAttribute).asRequired().bind("secretAttribute");
    ldap.addComponent(secretAttribute);
    TextField usernameExtractorRegexp = new TextField(msg.getMessage("LdapAuthenticatorEditor.usernameExtractorRegexp"));
    usernameExtractorRegexp.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(usernameExtractorRegexp).bind("usernameExtractorRegexp");
    ldap.addComponent(usernameExtractorRegexp);
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.ldap"), ldap);
}
Also used : FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) Autowired(org.springframework.beans.factory.annotation.Autowired) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) Validator(com.vaadin.data.Validator) CheckBox(com.vaadin.ui.CheckBox) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) TooltipExtension.tooltip(io.imunity.tooltip.TooltipExtension.tooltip) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Set(java.util.Set) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) Binder(com.vaadin.data.Binder) HashFunction(io.imunity.otp.HashFunction) EngineException(pl.edu.icm.unity.exceptions.EngineException) ObjectFactory(org.springframework.beans.factory.ObjectFactory) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) RadioButtonGroup(com.vaadin.ui.RadioButtonGroup) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Optional(java.util.Optional) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Filter(com.unboundid.ldap.sdk.Filter) Unit(com.vaadin.server.Sizeable.Unit) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) LDAPException(com.unboundid.ldap.sdk.LDAPException) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField)

Aggregations

CollapsibleLayout (pl.edu.icm.unity.webui.common.CollapsibleLayout)65 FormLayoutWithFixedCaptionWidth (pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth)52 VerticalLayout (com.vaadin.ui.VerticalLayout)37 I18nTextField (pl.edu.icm.unity.webui.common.i18n.I18nTextField)24 TextField (com.vaadin.ui.TextField)21 ComboBox (com.vaadin.ui.ComboBox)20 CheckBox (com.vaadin.ui.CheckBox)18 Binder (com.vaadin.data.Binder)13 Component (com.vaadin.ui.Component)13 MessageSource (pl.edu.icm.unity.MessageSource)13 GridWithEditor (pl.edu.icm.unity.webui.common.GridWithEditor)13 Set (java.util.Set)12 ValidationResult (com.vaadin.data.ValidationResult)11 FormValidationException (pl.edu.icm.unity.webui.common.FormValidationException)11 SubViewSwitcher (pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher)11 IntegerRangeValidator (com.vaadin.data.validator.IntegerRangeValidator)10 List (java.util.List)10 FieldSizeConstans (pl.edu.icm.unity.webui.common.FieldSizeConstans)9 IntStepper (org.vaadin.risto.stepper.IntStepper)8 Button (com.vaadin.ui.Button)7