Search in sources :

Example 1 with ChipsWithTextfield

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

the class EditOAuthClientSubView method buildHeaderSection.

private FormLayoutWithFixedCaptionWidth buildHeaderSection() {
    FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
    header.setMargin(true);
    TextField name = new TextField();
    name.setCaption(msg.getMessage("EditOAuthClientSubView.name"));
    binder.forField(name).withValidator((v, c) -> {
        if (v != null && !v.isEmpty() && v.length() < 2) {
            return ValidationResult.error(msg.getMessage("toShortValue"));
        }
        return ValidationResult.ok();
    }).bind("name");
    header.addComponent(name);
    ComboBox<String> type = new ComboBox<>();
    type.setCaption(msg.getMessage("EditOAuthClientSubView.type"));
    type.setItems(Stream.of(ClientType.values()).map(f -> f.toString()).collect(Collectors.toList()));
    type.setEmptySelectionAllowed(false);
    binder.forField(type).bind("type");
    header.addComponent(type);
    TextFieldWithGenerator id = new TextFieldWithGenerator();
    id.setCaption(msg.getMessage("EditOAuthClientSubView.id"));
    id.setReadOnly(editMode);
    id.setWidth(30, Unit.EM);
    binder.forField(id).asRequired(msg.getMessage("fieldRequired")).withValidator((v, c) -> {
        if (v != null && allClientsIds.contains(v)) {
            return ValidationResult.error(msg.getMessage("EditOAuthClientSubView.invalidClientId"));
        }
        return ValidationResult.ok();
    }).bind("id");
    header.addComponent(id);
    CustomField<String> secret;
    if (!editMode) {
        secret = new TextFieldWithGenerator();
        secret.setCaption(msg.getMessage("EditOAuthClientSubView.secret"));
        secret.setWidth(30, Unit.EM);
        binder.forField(secret).withValidator((v, c) -> {
            if ((v == null || v.isEmpty()) && ClientType.CONFIDENTIAL.toString().equals(type.getValue())) {
                return ValidationResult.error(msg.getMessage("fieldRequired"));
            }
            return ValidationResult.ok();
        }).bind("secret");
        header.addComponent(secret);
    } else {
        TextFieldWithChangeConfirmation<TextFieldWithGenerator> secretWithChangeConfirmation = new TextFieldWithChangeConfirmation<>(msg, new TextFieldWithGenerator());
        secretWithChangeConfirmation.setCaption(msg.getMessage("EditOAuthClientSubView.secret"));
        secretWithChangeConfirmation.setWidth(30, Unit.EM);
        binder.forField(secretWithChangeConfirmation).withValidator((v, c) -> {
            if (secretWithChangeConfirmation.isEditMode()) {
                return ValidationResult.error(msg.getMessage("fieldRequired"));
            }
            return ValidationResult.ok();
        }).bind("secret");
        header.addComponent(secretWithChangeConfirmation);
        secret = secretWithChangeConfirmation;
    }
    type.addValueChangeListener(e -> {
        secret.setEnabled(ClientType.CONFIDENTIAL.toString().equals(e.getValue()));
        if (!secret.isEnabled())
            secret.setValue("");
    });
    ChipsWithDropdown<String> allowedFlows = new ChipsWithDropdown<>();
    allowedFlows.setCaption(msg.getMessage("EditOAuthClientSubView.allowedFlows"));
    allowedFlows.setItems(Stream.of(GrantFlow.values()).map(f -> f.toString()).collect(Collectors.toList()));
    binder.forField(allowedFlows).withValidator((v, c) -> {
        if (v == null || v.isEmpty()) {
            return ValidationResult.error(msg.getMessage("fieldRequired"));
        }
        return ValidationResult.ok();
    }).bind("flows");
    header.addComponent(allowedFlows);
    ChipsWithTextfield redirectURIs = new ChipsWithTextfield(msg);
    redirectURIs.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    redirectURIs.setCaption(msg.getMessage("EditOAuthClientSubView.authorizedRedirectURIs"));
    binder.forField(redirectURIs).withValidator((v, c) -> {
        if (v == null || v.size() == 0) {
            return ValidationResult.error(msg.getMessage("fieldRequired"));
        }
        return ValidationResult.ok();
    }).bind("redirectURIs");
    header.addComponent(redirectURIs);
    Set<String> definedScopes = scopesSupplier.get();
    ChipsWithDropdown<String> allowedScopes = new ChipsWithDropdown<>();
    allowedScopes.setCaption(msg.getMessage("EditOAuthClientSubView.allowedScopes"));
    allowedScopes.setItems(definedScopes);
    allowedScopes.setSkipRemoveInvalidSelections(true);
    binder.forField(allowedScopes).withValidator((v, c) -> {
        if (v != null && !v.isEmpty() && !definedScopes.containsAll(v)) {
            return ValidationResult.error(msg.getMessage("EditOAuthClientSubView.invalidAllowedScopes"));
        }
        return ValidationResult.ok();
    }).bind("scopes");
    CheckBox allowAllScopes = new CheckBox(msg.getMessage("EditOAuthClientSubView.allowAllScopes"));
    binder.forField(allowAllScopes).bind("allowAnyScopes");
    allowAllScopes.addValueChangeListener(v -> allowedScopes.setEnabled(!v.getValue()));
    header.addComponent(allowAllScopes);
    header.addComponent(allowedScopes);
    return header;
}
Also used : CustomField(com.vaadin.ui.CustomField) FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) Arrays(java.util.Arrays) CustomComponent(com.vaadin.ui.CustomComponent) TextField(com.vaadin.ui.TextField) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) ComboBox(com.vaadin.ui.ComboBox) ValidationResult(com.vaadin.data.ValidationResult) ImageField(pl.edu.icm.unity.webui.common.file.ImageField) Supplier(java.util.function.Supplier) UnityServerConfiguration(pl.edu.icm.unity.engine.api.config.UnityServerConfiguration) UnitySubView(pl.edu.icm.unity.webui.common.webElements.UnitySubView) CheckBox(com.vaadin.ui.CheckBox) MessageSource(pl.edu.icm.unity.MessageSource) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) Set(java.util.Set) UUID(java.util.UUID) ConfirmDialog(pl.edu.icm.unity.webui.common.ConfirmDialog) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) StandardButtonsHelper(pl.edu.icm.unity.webui.common.StandardButtonsHelper) Collectors(java.util.stream.Collectors) Binder(com.vaadin.data.Binder) Images(pl.edu.icm.unity.webui.common.Images) TextFieldWithChangeConfirmation(pl.edu.icm.unity.webui.common.TextFieldWithChangeConfirmation) Consumer(java.util.function.Consumer) ClientType(com.nimbusds.oauth2.sdk.client.ClientType) List(java.util.List) Button(com.vaadin.ui.Button) Stream(java.util.stream.Stream) HorizontalLayout(com.vaadin.ui.HorizontalLayout) URIAccessService(pl.edu.icm.unity.engine.api.files.URIAccessService) CopyToClipboardButton(io.imunity.webelements.clipboard.CopyToClipboardButton) Styles(pl.edu.icm.unity.webui.common.Styles) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) GrantFlow(pl.edu.icm.unity.oauth.as.OAuthSystemAttributesProvider.GrantFlow) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown) Component(com.vaadin.ui.Component) ComboBox(com.vaadin.ui.ComboBox) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) CheckBox(com.vaadin.ui.CheckBox) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) TextFieldWithChangeConfirmation(pl.edu.icm.unity.webui.common.TextFieldWithChangeConfirmation) TextField(com.vaadin.ui.TextField)

Example 2 with ChipsWithTextfield

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

the class RestAdminServiceEditorGeneralTab method buildCorsSection.

private Component buildCorsSection() {
    FormLayoutWithFixedCaptionWidth main = new FormLayoutWithFixedCaptionWidth();
    main.setMargin(false);
    ChipsWithTextfield allowedCORSheaders = new ChipsWithTextfield(msg);
    allowedCORSheaders.setCaption(msg.getMessage("RestAdminServiceEditorComponent.allowedCORSheaders"));
    restBinder.forField(allowedCORSheaders).bind("allowedCORSheaders");
    main.addComponent(allowedCORSheaders);
    ChipsWithTextfield allowedCORSorigins = new ChipsWithTextfield(msg);
    allowedCORSorigins.setCaption(msg.getMessage("RestAdminServiceEditorComponent.allowedCORSorigins"));
    main.addComponent(allowedCORSorigins);
    restBinder.forField(allowedCORSorigins).bind("allowedCORSorigins");
    CollapsibleLayout corsSection = new CollapsibleLayout(msg.getMessage("RestAdminServiceEditorComponent.cors"), main);
    return corsSection;
}
Also used : CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield)

Example 3 with ChipsWithTextfield

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

the class EditOAuthProviderSubView method buildHeaderSection.

private FormLayoutWithFixedCaptionWidth buildHeaderSection(Set<String> providersIds) {
    FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
    header.setMargin(true);
    loadTemplates();
    templateCombo = new ComboBox<>();
    templateCombo.setCaption(msg.getMessage("EditOAuthProviderSubView.template"));
    templateCombo.setItems(templates.keySet().stream().sorted());
    templateCombo.setEmptySelectionAllowed(false);
    configBinder.forField(templateCombo).asRequired(msg.getMessage("fieldRequired")).bind("type");
    if (!editMode) {
        header.addComponent(templateCombo);
    }
    TextField id = new TextField(msg.getMessage("EditOAuthProviderSubView.id"));
    configBinder.forField(id).asRequired(msg.getMessage("fieldRequired")).withValidator((s, c) -> {
        if (providersIds.contains(s)) {
            return ValidationResult.error(msg.getMessage("EditOAuthProviderSubView.idExists"));
        } else {
            return ValidationResult.ok();
        }
    }).withValidator(new NoSpaceValidator(msg)).bind("id");
    id.setReadOnly(editMode);
    header.addComponent(id);
    I18nTextField name = new I18nTextField(msg, msg.getMessage("EditOAuthProviderSubView.name"));
    configBinder.forField(name).asRequired(msg.getMessage("fieldRequired")).bind("name");
    header.addComponent(name);
    TextField clientId = new TextField(msg.getMessage("EditOAuthProviderSubView.clientId"));
    clientId.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(clientId).asRequired(msg.getMessage("fieldRequired")).bind("clientId");
    header.addComponent(clientId);
    TextField clientSecret = new TextField(msg.getMessage("EditOAuthProviderSubView.clientSecret"));
    clientSecret.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(clientSecret).asRequired(msg.getMessage("fieldRequired")).bind("clientSecret");
    header.addComponent(clientSecret);
    ChipsWithTextfield requestedScopes = new ChipsWithTextfield(msg);
    requestedScopes.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    requestedScopes.setCaption(msg.getMessage("EditOAuthProviderSubView.requestedScopes"));
    header.addComponent(requestedScopes);
    configBinder.forField(requestedScopes).bind("requestedScopes");
    ImageField logo = new ImageField(msg, uriAccessService, serverConfig.getFileSizeLimit());
    logo.setCaption(msg.getMessage("EditOAuthProviderSubView.logo"));
    logo.configureBinding(configBinder, "logo");
    header.addComponent(logo);
    CheckBox openIdConnect = new CheckBox(msg.getMessage("EditOAuthProviderSubView.openIdConnect"));
    configBinder.forField(openIdConnect).bind("openIdConnect");
    header.addComponent(openIdConnect);
    TextField openIdDiscovery = new TextField(msg.getMessage("EditOAuthProviderSubView.openIdDiscoverEndpoint"));
    openIdDiscovery.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    configBinder.forField(openIdDiscovery).asRequired(getOpenIdFieldValidator(openIdConnect, true)).bind("openIdDiscoverEndpoint");
    openIdDiscovery.setVisible(false);
    openIdDiscovery.setRequiredIndicatorVisible(false);
    header.addComponent(openIdDiscovery);
    openIdConnect.addValueChangeListener(e -> openIdDiscovery.setVisible(e.getValue()));
    TextField authenticationEndpoint = new TextField(msg.getMessage("EditOAuthProviderSubView.authenticationEndpoint"));
    configBinder.forField(authenticationEndpoint).asRequired(getOpenIdFieldValidator(openIdConnect, false)).bind("authenticationEndpoint");
    authenticationEndpoint.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    authenticationEndpoint.setRequiredIndicatorVisible(false);
    header.addComponent(authenticationEndpoint);
    TextField accessTokenEndpoint = new TextField(msg.getMessage("EditOAuthProviderSubView.accessTokenEndpoint"));
    accessTokenEndpoint.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    configBinder.forField(accessTokenEndpoint).asRequired(getOpenIdFieldValidator(openIdConnect, false)).bind("accessTokenEndpoint");
    accessTokenEndpoint.setRequiredIndicatorVisible(false);
    header.addComponent(accessTokenEndpoint);
    TextField profileEndpoint = new TextField(msg.getMessage("EditOAuthProviderSubView.profileEndpoint"));
    profileEndpoint.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    configBinder.forField(profileEndpoint).bind("profileEndpoint");
    header.addComponent(profileEndpoint);
    return header;
}
Also used : ImageField(pl.edu.icm.unity.webui.common.file.ImageField) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) CheckBox(com.vaadin.ui.CheckBox) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) NoSpaceValidator(pl.edu.icm.unity.webui.common.validators.NoSpaceValidator)

Example 4 with ChipsWithTextfield

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

the class OAuthRPAuthenticatorEditor method buildHeaderSection.

private FormLayout buildHeaderSection() {
    FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
    header.setMargin(true);
    header.addComponent(name);
    TextField clientId = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.clientId"));
    clientId.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(clientId).asRequired(msg.getMessage("fieldRequired")).bind("clientId");
    header.addComponent(clientId);
    TextField clientSecret = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.clientSecret"));
    clientSecret.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(clientSecret).asRequired(msg.getMessage("fieldRequired")).bind("clientSecret");
    header.addComponent(clientSecret);
    ChipsWithTextfield requiredScopes = new ChipsWithTextfield(msg);
    requiredScopes.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    requiredScopes.setCaption(msg.getMessage("OAuthRPAuthenticatorEditor.requiredScopes"));
    header.addComponent(requiredScopes);
    configBinder.forField(requiredScopes).bind("requiredScopes");
    ComboBox<VerificationProtocol> verificationProtocol = new ComboBox<>(msg.getMessage("OAuthRPAuthenticatorEditor.verificationProtocol"));
    verificationProtocol.setItems(VerificationProtocol.values());
    verificationProtocol.setEmptySelectionAllowed(false);
    configBinder.forField(verificationProtocol).bind("verificationProtocol");
    header.addComponent(verificationProtocol);
    TextField verificationEndpoint = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.verificationEndpoint"));
    verificationEndpoint.setWidth(LINK_FIELD_WIDTH, Unit.EM);
    verificationEndpoint.setRequiredIndicatorVisible(false);
    configBinder.forField(verificationEndpoint).asRequired((v, c) -> {
        if (verificationProtocol.getValue() != VerificationProtocol.internal && v.isEmpty()) {
            return ValidationResult.error(msg.getMessage("fieldRequired"));
        } else {
            return ValidationResult.ok();
        }
    }).bind("verificationEndpoint");
    header.addComponent(verificationEndpoint);
    TextField profileEndpoint = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.profileEndpoint"));
    profileEndpoint.setWidth(LINK_FIELD_WIDTH, Unit.EM);
    configBinder.forField(profileEndpoint).bind("profileEndpoint");
    header.addComponent(profileEndpoint);
    return header;
}
Also used : FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) CheckBox(com.vaadin.ui.CheckBox) ClientAuthnMode(pl.edu.icm.unity.oauth.client.config.CustomProviderProperties.ClientAuthnMode) ClientHttpMethod(pl.edu.icm.unity.oauth.client.config.CustomProviderProperties.ClientHttpMethod) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) OAuthTokenRepository(pl.edu.icm.unity.oauth.as.OAuthTokenRepository) MessageSource(pl.edu.icm.unity.MessageSource) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) ServerHostnameCheckingMode(eu.unicore.util.httpclient.ServerHostnameCheckingMode) Set(java.util.Set) InputTranslationProfileFieldFactory(io.imunity.webconsole.utils.tprofile.InputTranslationProfileFieldFactory) BearerTokenVerificator(pl.edu.icm.unity.oauth.rp.verificator.BearerTokenVerificator) VerificationProtocol(pl.edu.icm.unity.oauth.rp.OAuthRPProperties.VerificationProtocol) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) Binder(com.vaadin.data.Binder) EngineException(pl.edu.icm.unity.exceptions.EngineException) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) FormLayout(com.vaadin.ui.FormLayout) ConfigurationException(eu.unicore.util.configuration.ConfigurationException) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Unit(com.vaadin.server.Sizeable.Unit) Component(com.vaadin.ui.Component) VerificationProtocol(pl.edu.icm.unity.oauth.rp.OAuthRPProperties.VerificationProtocol) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) ComboBox(com.vaadin.ui.ComboBox) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) TextField(com.vaadin.ui.TextField)

Example 5 with ChipsWithTextfield

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

the class EditIndividualTrustedSPSubView method buildHeaderSection.

private FormLayout buildHeaderSection() {
    FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
    header.setMargin(true);
    TextField name = new TextField(msg.getMessage("EditIndividualTrustedSPSubView.name"));
    name.focus();
    configBinder.forField(name).asRequired(msg.getMessage("fieldRequired")).withValidator(new NoSpaceValidator(msg)).withValidator((s, c) -> {
        if (usedNames.contains(s)) {
            return ValidationResult.error(msg.getMessage("EditIndividualTrustedSPSubView.nameExists"));
        } else {
            return ValidationResult.ok();
        }
    }).bind("name");
    header.addComponent(name);
    I18nTextField displayedName = new I18nTextField(msg, msg.getMessage("EditIndividualTrustedSPSubView.displayedName"));
    configBinder.forField(displayedName).bind("displayedName");
    header.addComponent(displayedName);
    ImageField logo = new ImageField(msg, uriAccessService, serverConfig.getFileSizeLimit());
    logo.setCaption(msg.getMessage("EditIndividualTrustedSPSubView.logo"));
    logo.configureBinding(configBinder, "logo");
    header.addComponent(logo);
    CheckBox x500Name = new CheckBox(msg.getMessage("EditIndividualTrustedSPSubView.X500NameUse"));
    configBinder.forField(x500Name).bind("x500Name");
    header.addComponent(x500Name);
    TextField id = new TextField(msg.getMessage("EditIndividualTrustedSPSubView.id"));
    id.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    configBinder.forField(id).asRequired(msg.getMessage("fieldRequired")).withValidator((s, c) -> {
        if (x500Name.getValue()) {
            try {
                new X500Name(s);
                return ValidationResult.ok();
            } catch (Exception e) {
                return ValidationResult.error(msg.getMessage("EditIndividualTrustedSPSubView.invalidX500Name"));
            }
        } else {
            return ValidationResult.ok();
        }
    }).bind("id");
    header.addComponent(id);
    ChipsWithDropdown<String> certificatesCombo = new ChipsWithDropdown<>();
    certificatesCombo.setCaption(msg.getMessage("EditIndividualTrustedSPSubView.certificates"));
    certificatesCombo.setItems(certificates.stream().collect(Collectors.toList()));
    configBinder.forField(certificatesCombo).bind("certificates");
    header.addComponent(certificatesCombo);
    CheckBox encryptAssertions = new CheckBox(msg.getMessage("EditIndividualTrustedSPSubView.encryptAssertions"));
    configBinder.forField(encryptAssertions).bind("encryptAssertions");
    header.addComponent(encryptAssertions);
    ChipsWithTextfield authorizedURIs = new ChipsWithTextfield(msg);
    authorizedURIs.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    authorizedURIs.setCaption(msg.getMessage("EditIndividualTrustedSPSubView.authorizedURIs"));
    configBinder.forField(authorizedURIs).withValidator((v, c) -> {
        if (v == null || v.isEmpty()) {
            return ValidationResult.error(msg.getMessage("fieldRequired"));
        }
        return ValidationResult.ok();
    }).bind("authorizedRedirectsUri");
    header.addComponent(authorizedURIs);
    return header;
}
Also used : FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) Arrays(java.util.Arrays) CustomComponent(com.vaadin.ui.CustomComponent) TextField(com.vaadin.ui.TextField) VerticalLayout(com.vaadin.ui.VerticalLayout) ValidationResult(com.vaadin.data.ValidationResult) ImageField(pl.edu.icm.unity.webui.common.file.ImageField) NoSpaceValidator(pl.edu.icm.unity.webui.common.validators.NoSpaceValidator) UnityServerConfiguration(pl.edu.icm.unity.engine.api.config.UnityServerConfiguration) X500Name(org.bouncycastle.asn1.x500.X500Name) UnitySubView(pl.edu.icm.unity.webui.common.webElements.UnitySubView) CheckBox(com.vaadin.ui.CheckBox) MessageSource(pl.edu.icm.unity.MessageSource) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) Set(java.util.Set) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) StandardButtonsHelper(pl.edu.icm.unity.webui.common.StandardButtonsHelper) Collectors(java.util.stream.Collectors) Binder(com.vaadin.data.Binder) Consumer(java.util.function.Consumer) List(java.util.List) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) URIAccessService(pl.edu.icm.unity.engine.api.files.URIAccessService) FormLayout(com.vaadin.ui.FormLayout) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown) X500Name(org.bouncycastle.asn1.x500.X500Name) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) ImageField(pl.edu.icm.unity.webui.common.file.ImageField) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) CheckBox(com.vaadin.ui.CheckBox) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) NoSpaceValidator(pl.edu.icm.unity.webui.common.validators.NoSpaceValidator)

Aggregations

ChipsWithTextfield (pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield)9 TextField (com.vaadin.ui.TextField)7 FormLayoutWithFixedCaptionWidth (pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth)7 CollapsibleLayout (pl.edu.icm.unity.webui.common.CollapsibleLayout)6 Binder (com.vaadin.data.Binder)5 ValidationResult (com.vaadin.data.ValidationResult)5 MessageSource (pl.edu.icm.unity.MessageSource)5 CheckBox (com.vaadin.ui.CheckBox)4 VerticalLayout (com.vaadin.ui.VerticalLayout)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 I18nTextField (pl.edu.icm.unity.webui.common.i18n.I18nTextField)4 ComboBox (com.vaadin.ui.ComboBox)3 Component (com.vaadin.ui.Component)3 CustomComponent (com.vaadin.ui.CustomComponent)3 List (java.util.List)3 FieldSizeConstans (pl.edu.icm.unity.webui.common.FieldSizeConstans)3 FormValidationException (pl.edu.icm.unity.webui.common.FormValidationException)3 ImageField (pl.edu.icm.unity.webui.common.file.ImageField)3 Button (com.vaadin.ui.Button)2