Search in sources :

Example 1 with SubViewSwitcher

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

the class CompositePasswordAuthenticatorEditor method getEditor.

@Override
public Component getEditor(AuthenticatorDefinition toEdit, SubViewSwitcher switcher, boolean forceNameEditable) {
    this.subViewSwitcher = switcher;
    boolean editMode = init(msg.getMessage("CompositePasswordAuthenticatorEditor.defaultName"), toEdit, forceNameEditable);
    configBinder = new Binder<>(CompositePasswordConfiguration.class);
    ChipsWithDropdown<String> localCredentials = new ChipsWithDropdown<>(i -> i, true);
    localCredentials.setItems(credentialDefinitions.stream().filter(c -> c.getTypeId().equals(PasswordVerificator.NAME)).map(c -> c.getName()).collect(Collectors.toList()));
    localCredentials.setCaption(msg.getMessage("CompositePasswordAuthenticatorEditor.localCredentials"));
    configBinder.forField(localCredentials).bind("localCredentials");
    remoteAuthn = new RemoteAuthenticatorsComponent();
    remoteAuthn.setCaption(msg.getMessage("CompositePasswordAuthenticatorEditor.remoteAuthenticators"));
    configBinder.forField(remoteAuthn).bind("remoteAuthenticators");
    CollapsibleLayout interactiveLoginSettings = buildInteractiveLoginSettingsSection();
    CompositePasswordConfiguration config = new CompositePasswordConfiguration();
    if (editMode) {
        config.fromProperties(toEdit.configuration, msg);
    }
    configBinder.setBean(config);
    FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
    header.addComponent(name);
    header.addComponent(localCredentials);
    header.addComponent(remoteAuthn);
    VerticalLayout main = new VerticalLayout();
    main.setMargin(false);
    main.addComponent(header);
    main.addComponent(interactiveLoginSettings);
    return main;
}
Also used : CustomField(com.vaadin.ui.CustomField) PamAuthenticatorEditorFactory(pl.edu.icm.unity.pam.web.PamAuthenticatorEditorFactory) Arrays(java.util.Arrays) ClickListener(com.vaadin.ui.Button.ClickListener) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) PasswordVerificator(pl.edu.icm.unity.stdext.credential.pass.PasswordVerificator) ArrayList(java.util.ArrayList) CompositePasswordProperties(pl.edu.icm.unity.composite.password.CompositePasswordProperties) InternalException(pl.edu.icm.unity.exceptions.InternalException) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LdapAuthenticatorEditorFactory(pl.edu.icm.unity.ldap.client.console.LdapAuthenticatorEditorFactory) GridWithActionColumn(pl.edu.icm.unity.webui.common.GridWithActionColumn) MessageSource(pl.edu.icm.unity.MessageSource) Properties(java.util.Properties) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) SingleActionHandler(pl.edu.icm.unity.webui.common.SingleActionHandler) Collection(java.util.Collection) Set(java.util.Set) I18nString(pl.edu.icm.unity.types.I18nString) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) Collectors(java.util.stream.Collectors) Binder(com.vaadin.data.Binder) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) Images(pl.edu.icm.unity.webui.common.Images) Consumer(java.util.function.Consumer) List(java.util.List) Button(com.vaadin.ui.Button) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) StringReader(java.io.StringReader) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) PasswordRetrievalProperties(pl.edu.icm.unity.webui.authn.extensions.PasswordRetrievalProperties) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CredentialDefinition(pl.edu.icm.unity.types.authn.CredentialDefinition) ConfigurationException(eu.unicore.util.configuration.ConfigurationException) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) Styles(pl.edu.icm.unity.webui.common.Styles) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown) CompositePasswordVerificator(pl.edu.icm.unity.composite.password.CompositePasswordVerificator) Component(com.vaadin.ui.Component) VerificatorTypes(pl.edu.icm.unity.composite.password.CompositePasswordProperties.VerificatorTypes) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) VerticalLayout(com.vaadin.ui.VerticalLayout) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown) I18nString(pl.edu.icm.unity.types.I18nString)

Aggregations

Binder (com.vaadin.data.Binder)1 Alignment (com.vaadin.ui.Alignment)1 Button (com.vaadin.ui.Button)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 Component (com.vaadin.ui.Component)1 CustomField (com.vaadin.ui.CustomField)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ConfigurationException (eu.unicore.util.configuration.ConfigurationException)1 File (java.io.File)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 StandardCharsets (java.nio.charset.StandardCharsets)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 List (java.util.List)1 Properties (java.util.Properties)1 Set (java.util.Set)1 Consumer (java.util.function.Consumer)1