diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm.html
index ae5a92c54..af3a2964b 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_de.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_de.html
index ae5a92c54..af3a2964b 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_de.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_de.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_es.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_es.html
index ae5a92c54..af3a2964b 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_es.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_es.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_fr.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_fr.html
index ae5a92c54..af3a2964b 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_fr.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_fr.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_ja.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_ja.html
index ae5a92c54..af3a2964b 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_ja.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_ja.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_pt-BR.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_pt-BR.html
index ae5a92c54..af3a2964b 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_pt-BR.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_pt-BR.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_za-Hans.html b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_za-Hans.html
index acf5bec0b..6952b14db 100644
--- a/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_za-Hans.html
+++ b/gui/src/main/java/org/jboss/as/console/client/preview/content/elytron_security_realm_za-Hans.html
@@ -1,4 +1,4 @@
Security Realm
- Elytron settings for security realms.
+ Elytron settings for security realms and authentication.
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronFinderView.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronFinderView.java
index bd5faa164..4466cff53 100644
--- a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronFinderView.java
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronFinderView.java
@@ -50,7 +50,7 @@ public class ElytronFinderView extends SuspendableViewImpl implements ElytronFin
public static final String FACTORY = "Factory";
public static final String MAPPER_DECODER = "Mapper / Decoder";
- public static final String SECURITY_REALM = "Security Realm";
+ public static final String SECURITY_REALM = "Security Realm / Authentication";
public static final String OTHER = "Other";
private ElytronFinder presenter;
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronSecurityRealmPresenter.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronSecurityRealmPresenter.java
index b163ce289..4c093ee83 100644
--- a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronSecurityRealmPresenter.java
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ElytronSecurityRealmPresenter.java
@@ -72,7 +72,9 @@ void initSecurityRealm(
List mappedRegexRealmMapper,
List simpleRegexRealmMapper,
List customRealmMapper,
- List constantRealmMapper);
+ List constantRealmMapper,
+ List authContext,
+ List authConfiguration);
}
// @formatter:on
@@ -122,7 +124,9 @@ protected void onAction(Action action) {
store.getMappedRegexRealmMapper(),
store.getSimpleRegexRealmMapper(),
store.getCustomRealmMapper(),
- store.getConstantRealmMapper());
+ store.getConstantRealmMapper(),
+ store.getAuthenticationContext(),
+ store.getAuthenticationconfiguration());
}
}
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/store/ElytronStore.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/store/ElytronStore.java
index cf8a878d2..95708fbc5 100644
--- a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/store/ElytronStore.java
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/store/ElytronStore.java
@@ -143,6 +143,8 @@ public void onFailure(final AddressTemplate address, final String name, final Th
public static final AddressTemplate SECURITY_PROPERTY_ADDRESS = AddressTemplate.of(ROOT).append("security-property=*");
public static final AddressTemplate DIR_CONTEXT_ADDRESS = AddressTemplate.of(ROOT).append("dir-context=*");
+ public static final AddressTemplate AUTHENTICATION_CONTEXT_ADDRESS = AddressTemplate.of(ROOT).append("authentication-context=*");
+ public static final AddressTemplate AUTHENTICATION_CONF_ADDRESS = AddressTemplate.of(ROOT).append("authentication-configuration=*");
private final DispatchAsync dispatcher;
private final StatementContext statementContext;
@@ -217,6 +219,8 @@ public void onFailure(final AddressTemplate address, final String name, final Th
private final List securityDomain;
private final List securityProperty;
private final List dirContext;
+ private final List authenticationContext;
+ private final List authenticationconfiguration;
@Inject
public ElytronStore(final DispatchAsync dispatcher, StatementContext statementContext) {
@@ -295,6 +299,8 @@ public ElytronStore(final DispatchAsync dispatcher, StatementContext statementCo
securityProperty = new ArrayList<>();
dirContext = new ArrayList<>();
+ authenticationContext = new ArrayList<>();
+ authenticationconfiguration = new ArrayList<>();
}
@@ -397,6 +403,8 @@ public void onSuccess(final DMRResponse response) {
populate(payload, "security-property", securityProperty);
populate(payload, "dir-context", dirContext);
+ populate(payload, "authentication-context", authenticationContext);
+ populate(payload, "authentication-configuration", authenticationconfiguration);
channel.ack();
}
@@ -743,4 +751,12 @@ public List getDirContext() {
public List getProviderLoader() {
return providerLoader;
}
+
+ public List getAuthenticationContext() {
+ return authenticationContext;
+ }
+
+ public List getAuthenticationconfiguration() {
+ return authenticationconfiguration;
+ }
}
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationConfigurationView.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationConfigurationView.java
new file mode 100644
index 000000000..93cbe3f9c
--- /dev/null
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationConfigurationView.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2015-2016 Red Hat, Inc, and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.console.client.shared.subsys.elytron.ui;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.user.client.ui.Widget;
+import org.jboss.as.console.client.shared.subsys.elytron.store.ElytronStore;
+import org.jboss.as.console.client.shared.subsys.elytron.store.ModifyComplexAttribute;
+import org.jboss.as.console.client.v3.dmr.AddressTemplate;
+import org.jboss.as.console.client.v3.dmr.ResourceDescription;
+import org.jboss.as.console.mbui.widgets.ComplexAttributeForm;
+import org.jboss.as.console.mbui.widgets.ModelNodeFormBuilder;
+import org.jboss.ballroom.client.rbac.SecurityContext;
+import org.jboss.ballroom.client.widgets.forms.FormCallback;
+import org.jboss.dmr.client.Property;
+import org.jboss.gwt.circuit.Dispatcher;
+
+/**
+ * @author Claudio Miranda
+ */
+public class AuthenticationConfigurationView extends ElytronGenericResourceView {
+
+ public static final String COMPLEX_ATTRIBUTE = "credential-reference";
+ private ModelNodeFormBuilder.FormAssets credentialReferenceFormAsset;
+
+ public AuthenticationConfigurationView(final Dispatcher circuit,
+ final ResourceDescription resourceDescription,
+ final SecurityContext securityContext, final String title,
+ final AddressTemplate addressTemplate) {
+ super(circuit, resourceDescription, securityContext, title, addressTemplate);
+ excludesFormAttributes(COMPLEX_ATTRIBUTE);
+ }
+
+ @Override
+ public Map additionalTabDetails() {
+ Map additionalWidgets = new HashMap<>();
+ credentialReferenceFormAsset = new ComplexAttributeForm(COMPLEX_ATTRIBUTE, securityContext, resourceDescription).build();
+
+ credentialReferenceFormAsset.getForm().setToolsCallback(new FormCallback() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onSave(final Map changeset) {
+ circuit.dispatch(new ModifyComplexAttribute(ElytronStore.AUTHENTICATION_CONF_ADDRESS, COMPLEX_ATTRIBUTE,
+ selectionModel.getSelectedObject().getName(), credentialReferenceFormAsset.getForm().getUpdatedEntity()));
+ }
+
+ @Override
+ public void onCancel(final Object entity) {
+ credentialReferenceFormAsset.getForm().cancel();
+ }
+ });
+
+ additionalWidgets.put("Credential Reference", credentialReferenceFormAsset.asWidget());
+ return additionalWidgets;
+ }
+
+ @Override
+ public void update(final List models) {
+ super.update(models);
+ if (models.isEmpty()) {
+ credentialReferenceFormAsset.getForm().clearValues();
+ }
+ }
+
+ @Override
+ protected void selectTableItem(final Property prop) {
+ if (prop != null) {
+ credentialReferenceFormAsset.getForm().edit(prop.getValue().get(COMPLEX_ATTRIBUTE));
+ } else {
+ credentialReferenceFormAsset.getForm().clearValues();
+ }
+ }
+
+}
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationContextMatchRulesEditor.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationContextMatchRulesEditor.java
new file mode 100644
index 000000000..7e1d750d2
--- /dev/null
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationContextMatchRulesEditor.java
@@ -0,0 +1,310 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.as.console.client.shared.subsys.elytron.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.cell.client.ActionCell;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SingleSelectionModel;
+import org.jboss.as.console.client.Console;
+import org.jboss.as.console.client.StringUtils;
+import org.jboss.as.console.client.shared.subsys.elytron.store.AddListAttribute;
+import org.jboss.as.console.client.shared.subsys.elytron.store.ElytronStore;
+import org.jboss.as.console.client.shared.subsys.elytron.store.RemoveListAttribute;
+import org.jboss.as.console.client.v3.dmr.ResourceDescription;
+import org.jboss.as.console.client.v3.widgets.AddResourceDialog;
+import org.jboss.as.console.client.widgets.tables.ViewLinkCell;
+import org.jboss.as.console.mbui.widgets.ModelNodeForm;
+import org.jboss.as.console.mbui.widgets.ModelNodeFormBuilder;
+import org.jboss.ballroom.client.rbac.SecurityContext;
+import org.jboss.ballroom.client.widgets.forms.FormItem;
+import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import org.jboss.ballroom.client.widgets.tables.DefaultPager;
+import org.jboss.ballroom.client.widgets.tools.ToolButton;
+import org.jboss.ballroom.client.widgets.tools.ToolStrip;
+import org.jboss.ballroom.client.widgets.window.DefaultWindow;
+import org.jboss.ballroom.client.widgets.window.DialogueOptions;
+import org.jboss.ballroom.client.widgets.window.Feedback;
+import org.jboss.ballroom.client.widgets.window.WindowContentBuilder;
+import org.jboss.dmr.client.ModelNode;
+import org.jboss.dmr.client.Property;
+import org.jboss.gwt.circuit.Dispatcher;
+
+/**
+ * @author Claudio Miranda
+ */
+public class AuthenticationContextMatchRulesEditor implements IsWidget {
+
+
+ public static final String MATCH_RULES = "match-rules";
+
+ private DefaultCellTable table;
+ private ListDataProvider dataProvider;
+ private final SingleSelectionModel selectionModel;
+ private Dispatcher circuit;
+ private ResourceDescription resourceDescription;
+ private SecurityContext securityContext;
+ private String authContextName;
+ private ModelNodeForm matchRulesForm;
+ private VerticalPanel popupLayout = new VerticalPanel();
+ private DefaultWindow matchRulesWindow;
+
+ // button to hide the match-rules detail window
+ // the cancel button is not displayed
+ DialogueOptions popupDialogOptions = new DialogueOptions(Console.CONSTANTS.common_label_done(),
+
+ // done
+ new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ matchRulesWindow.hide();
+ }
+ },
+
+ Console.CONSTANTS.common_label_cancel(),
+ // cancel
+ new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ matchRulesWindow.hide();
+ }
+ }
+ );
+
+ AuthenticationContextMatchRulesEditor(final Dispatcher circuit, ResourceDescription resourceDescription,
+ SecurityContext securityContext) {
+ this.circuit = circuit;
+ this.securityContext = securityContext;
+ selectionModel = new SingleSelectionModel<>();
+
+ // tweak to use ModelNodeFormBuilder automatic form generation
+ this.resourceDescription = new ResourceDescription(resourceDescription.clone());
+ // adds the match-rules to the request-properties of add operation
+ ModelNode reqPropsDescription = this.resourceDescription.get("operations").get("add").get("request-properties");
+ // adds the mechanism-configuration to the attribute list
+ ModelNode attrPropsDescription = this.resourceDescription.get("attributes");
+ ModelNode matchRulesDescription = reqPropsDescription.get(MATCH_RULES).get("value-type");
+ reqPropsDescription.set(matchRulesDescription);
+ attrPropsDescription.set(matchRulesDescription);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Widget asWidget() {
+ VerticalPanel panel = new VerticalPanel();
+ panel.addStyleName("fill-popupLayout-width");
+
+ // table
+ table = new DefaultCellTable<>(5);
+ dataProvider = new ListDataProvider<>();
+ dataProvider.addDataDisplay(table);
+ table.setSelectionModel(selectionModel);
+
+ // columns
+ Column matchRuleColumn = new TextColumn() {
+ @Override
+ public String getValue(ModelNode node) {
+ // as the match-rules attribute is a list of attributes
+ // none of them is required, so there is not a unique colum to show, so all defined attributes are
+ // displayed, there is a "view" button that shows all attributes nicely formatted in a ModelNodeForm
+ StringBuilder content = new StringBuilder();
+ for (Property prop: node.asPropertyList()) {
+ content.append(prop.getName()).append(": ").append(prop.getValue().asString()).append(", ");
+ }
+ return StringUtils.shortenStringIfNecessary(content.toString(), 120);
+ }
+ };
+
+ Column linkOpenDetailsColumn = new Column(
+ new ViewLinkCell<>(Console.CONSTANTS.common_label_view(),
+ (ActionCell.Delegate) selection -> showDetailModal(selection))
+ ) {
+ @Override
+ public ModelNode getValue(ModelNode node) {
+ return node;
+ }
+ };
+
+ linkOpenDetailsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
+ table.addColumn(matchRuleColumn, "");
+ table.addColumn(linkOpenDetailsColumn, "Option");
+ table.setColumnWidth(linkOpenDetailsColumn, 8, Style.Unit.PCT);
+
+ panel.add(mainTableTools());
+ panel.add(table);
+
+ DefaultPager pager = new DefaultPager();
+ pager.setDisplay(table);
+ panel.add(pager);
+
+ // ===================== match-rule form popup
+ popupLayout.setStyleName("window-content");
+
+ // read-only form to show details of match-rules attribute
+ ModelNodeFormBuilder.FormAssets detailForm = new ModelNodeFormBuilder()
+ .setResourceDescription(resourceDescription)
+ .setCreateMode(false)
+ .unsorted()
+ .setCreateNameAttribute(false)
+ .setSecurityContext(securityContext)
+ .build();
+ matchRulesForm = detailForm.getForm();
+
+ popupDialogOptions.showCancel(false);
+ Widget formWidget = detailForm.getForm().asWidget();
+ popupLayout.add(formWidget);
+
+ return panel;
+ }
+
+ private ToolStrip mainTableTools() {
+ ToolStrip tools = new ToolStrip();
+ ToolButton addButton = new ToolButton(Console.CONSTANTS.common_label_add(), event -> {
+
+ ModelNodeFormBuilder.FormAssets addFormAssets = new ModelNodeFormBuilder()
+ .setResourceDescription(resourceDescription)
+ .setCreateMode(true)
+ .unsorted()
+ .setCreateNameAttribute(false)
+ .setSecurityContext(securityContext)
+ .build();
+ addFormAssets.getForm().setEnabled(true);
+ addFormAssets.getForm().addFormValidator((formItems, formValidation) -> {
+
+ // at least one field is necessary to fill
+ boolean allEmpty = true;
+ for (FormItem formItem : formItems) {
+ if (!formItem.isUndefined()) {
+ allEmpty = false;
+ break;
+ }
+ }
+ if (allEmpty) {
+ formValidation.addError("match-abstract-type");
+ FormItem mechanismNameFormItem = formItem(formItems, "match-abstract-type");
+ mechanismNameFormItem.setErrMessage("At least one field must contain valid values.");
+ mechanismNameFormItem.setErroneous(true);
+ }
+ });
+
+ DefaultWindow dialog = new DefaultWindow(Console.MESSAGES.newTitle("Match Rule"));
+ AddResourceDialog.Callback callback = new AddResourceDialog.Callback() {
+ @Override
+ public void onAdd(ModelNode payload) {
+ for (Property node: payload.asPropertyList()) {
+ // remove undefined attributes
+ if (!node.getValue().isDefined()) {
+ payload.remove(node.getName());
+ }
+
+ }
+ circuit.dispatch(new AddListAttribute(ElytronStore.AUTHENTICATION_CONTEXT_ADDRESS,
+ MATCH_RULES,
+ authContextName,
+ payload));
+ dialog.hide();
+ }
+
+ @Override
+ public void onCancel() {
+ dialog.hide();
+ }
+ };
+ AddResourceDialog addDialog = new AddResourceDialog(addFormAssets, resourceDescription, callback);
+ dialog.setWidth(480);
+ dialog.setHeight(510);
+ dialog.setWidget(addDialog);
+ dialog.setGlassEnabled(true);
+ dialog.center();
+ });
+ ToolButton removeButton = new ToolButton(Console.CONSTANTS.common_label_delete(), event -> {
+ final ModelNode selection = selectionModel.getSelectedObject();
+ if (selection != null) {
+ Feedback.confirm("Match Rule", Console.MESSAGES.deleteConfirm("Match Rule " + selection.asString()),
+ isConfirmed -> {
+ if (isConfirmed) {
+ circuit.dispatch(new RemoveListAttribute(
+ ElytronStore.AUTHENTICATION_CONTEXT_ADDRESS,
+ authContextName,
+ MATCH_RULES,
+ selection));
+ }
+ });
+ }
+ });
+ tools.addToolButtonRight(addButton);
+ tools.addToolButtonRight(removeButton);
+ return tools;
+ }
+
+ private void showDetailModal(final ModelNode selection) {
+
+ matchRulesForm.editTransient(selection);
+ Widget windowContent = new WindowContentBuilder(popupLayout, popupDialogOptions).build();
+
+ matchRulesWindow = new DefaultWindow("Match Rule");
+ matchRulesWindow.setWidth(480);
+ matchRulesWindow.setHeight(430);
+ matchRulesWindow.trapWidget(windowContent);
+ matchRulesWindow.setGlassEnabled(true);
+ matchRulesWindow.center();
+ }
+
+ public void update(Property prop) {
+ authContextName = prop.getName();
+ if (prop.getValue().hasDefined(MATCH_RULES)) {
+ List models = prop.getValue().get(MATCH_RULES).asList();
+ table.setRowCount(models.size(), true);
+
+ List dataList = dataProvider.getList();
+ dataList.clear();
+ dataList.addAll(models);
+ } else {
+ clearValues();
+ }
+ selectionModel.clear();
+ }
+
+ public void clearValues() {
+ dataProvider.setList(new ArrayList<>());
+ }
+
+ protected FormItem formItem(List formItems, String name) {
+ for (FormItem formItem : formItems) {
+ if (name.equals(formItem.getName())) {
+ return formItem;
+ }
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationContextView.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationContextView.java
new file mode 100644
index 000000000..2cd128960
--- /dev/null
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationContextView.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2015-2016 Red Hat, Inc, and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.console.client.shared.subsys.elytron.ui;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.user.client.ui.Widget;
+import org.jboss.as.console.client.v3.dmr.AddressTemplate;
+import org.jboss.as.console.client.v3.dmr.ResourceDescription;
+import org.jboss.ballroom.client.rbac.SecurityContext;
+import org.jboss.dmr.client.ModelNode;
+import org.jboss.dmr.client.Property;
+import org.jboss.gwt.circuit.Dispatcher;
+
+/**
+ * @author Claudio Miranda
+ */
+public class AuthenticationContextView extends ElytronGenericResourceView {
+
+ private AuthenticationContextMatchRulesEditor matchRules;
+
+ public AuthenticationContextView(final Dispatcher circuit,
+ final ResourceDescription resourceDescription,
+ final SecurityContext securityContext, final String title,
+ final AddressTemplate addressTemplate) {
+ super(circuit, resourceDescription, securityContext, title, addressTemplate);
+ excludesFormAttributes("match-rules");
+ }
+
+ @Override
+ public Map additionalTabDetails() {
+ Map additionalWidgets = new HashMap<>();
+ matchRules = new AuthenticationContextMatchRulesEditor(circuit, resourceDescription, securityContext);
+ additionalWidgets.put("Match Rules", matchRules.asWidget());
+ return additionalWidgets;
+ }
+
+ @Override
+ public void update(final List models) {
+ super.update(models);
+ if (models.isEmpty()) {
+ matchRules.clearValues();
+ }
+ }
+
+ @Override
+ protected void selectTableItem(final Property prop) {
+ if (prop != null) {
+ matchRules.update(prop);
+ } else {
+ matchRules.clearValues();
+ }
+ }
+
+ @Override
+ protected void onAddCallback(final ModelNode payload) {
+ // add the default-realm to the realms list.
+ //payload.get("match-rules").setEmptyList().add("realm", payload.get("default-realm").asString());
+ }
+}
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationView.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationView.java
new file mode 100644
index 000000000..7a4322676
--- /dev/null
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/AuthenticationView.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2015-2016 Red Hat, Inc, and individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.console.client.shared.subsys.elytron.ui;
+
+import java.util.List;
+
+import com.google.gwt.user.client.ui.Widget;
+import org.jboss.as.console.client.shared.subsys.elytron.store.ElytronStore;
+import org.jboss.as.console.client.v3.dmr.ResourceDescription;
+import org.jboss.as.console.client.widgets.pages.PagedView;
+import org.jboss.ballroom.client.rbac.SecurityContext;
+import org.jboss.dmr.client.Property;
+import org.jboss.gwt.circuit.Dispatcher;
+
+/**
+ * @author Claudio Miranda
+ */
+public class AuthenticationView {
+
+ private Dispatcher circuit;
+ private ResourceDescription rootDescription;
+ private SecurityContext securityContext;
+
+ private AuthenticationConfigurationView authenticationConfigurationView;
+ private AuthenticationContextView authenticationContextView;
+
+ public AuthenticationView(final Dispatcher circuit, final ResourceDescription rootDescription,
+ final SecurityContext securityFramework) {
+ this.circuit = circuit;
+ this.rootDescription = rootDescription;
+ this.securityContext = securityFramework;
+ }
+
+ public Widget asWidget() {
+
+ ResourceDescription authContextDescription = rootDescription.getChildDescription("authentication-context");
+ ResourceDescription authConfDescription = rootDescription.getChildDescription("authentication-configuration");
+
+ authenticationConfigurationView = new AuthenticationConfigurationView(circuit, authConfDescription, securityContext, "Authentication Configuration",
+ ElytronStore.AUTHENTICATION_CONF_ADDRESS);
+ authenticationContextView = new AuthenticationContextView(circuit, authContextDescription, securityContext, "Authentication Context",
+ ElytronStore.AUTHENTICATION_CONTEXT_ADDRESS);
+
+ PagedView panel = new PagedView(true);
+ panel.addPage("Authentication Configuration", authenticationConfigurationView.asWidget());
+ panel.addPage("Authentication Context", authenticationContextView.asWidget());
+ // default page
+ panel.showPage(0);
+
+ return panel.asWidget();
+ }
+
+ public void updateAuthenticationConfiguration(final List models) {
+ authenticationConfigurationView.update(models);
+ }
+
+ public void updateAuthenticationContext(final List models) {
+ authenticationContextView.update(models);
+ }
+
+
+}
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/ElytronSecurityRealmView.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/ElytronSecurityRealmView.java
index 2104f42f1..61e9d2295 100644
--- a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/ElytronSecurityRealmView.java
+++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/elytron/ui/ElytronSecurityRealmView.java
@@ -40,8 +40,10 @@ public class ElytronSecurityRealmView extends SuspendableViewImpl implements Ely
private final ResourceDescriptionRegistry resourceDescriptionRegistry;
private final SecurityFramework securityFramework;
private ElytronSecurityRealmPresenter presenter;
+
private SecurityRealmView securityRealmView;
private SecurityRealmMapperView securityRealmMapperView;
+ private AuthenticationView authenticationView;
@Inject
public ElytronSecurityRealmView(final Dispatcher circuit, final ResourceDescriptionRegistry resourceDescriptionRegistry,
@@ -56,27 +58,29 @@ public Widget createWidget() {
SecurityContext securityContext = securityFramework.getSecurityContext(presenter.getProxy().getNameToken());
ResourceDescription rootDescription = resourceDescriptionRegistry.lookup(ElytronStore.ROOT_ADDRESS);
-
+
DefaultTabLayoutPanel tabLayoutpanel = new DefaultTabLayoutPanel(40, Style.Unit.PX);
tabLayoutpanel.addStyleName("default-tabpanel");
-
+
securityRealmView = new SecurityRealmView(circuit, rootDescription, securityContext);
securityRealmMapperView = new SecurityRealmMapperView(circuit, rootDescription, securityContext);
+ authenticationView = new AuthenticationView(circuit, rootDescription, securityContext);
tabLayoutpanel.add(securityRealmView.asWidget(), "Security Realm", true);
tabLayoutpanel.add(securityRealmMapperView.asWidget(), "Security Realm Mapper", true);
+ tabLayoutpanel.add(authenticationView.asWidget(), "Authentication", true);
tabLayoutpanel.selectTab(0);
return tabLayoutpanel;
}
@Override
- public void initSecurityRealm(List propertiesRealm, List filesystemRealm,
- List jdbcRealm, List ldapRealm, List keystoreRealm,
+ public void initSecurityRealm(List propertiesRealm, List filesystemRealm,
+ List jdbcRealm, List ldapRealm, List keystoreRealm,
List aggregateRealm, List customModifiableRealm, List customRealm,
List identityRealm, List tokenRealm,
List mappedRegexRealmMapper, List simpleRegexRealmMapper, List customRealmMapper,
- List constantRealmMapper) {
-
+ List constantRealmMapper, List authContext, List authConfiguration) {
+
securityRealmView.updatePropertiesRealm(propertiesRealm);
securityRealmView.updateFilesystemRealm(filesystemRealm);
securityRealmView.updateJdbcRealm(jdbcRealm);
@@ -87,12 +91,15 @@ public void initSecurityRealm(List propertiesRealm, List fil
securityRealmView.updateCustomRealm(customRealm);
securityRealmView.updateIdentityRealm(identityRealm);
securityRealmView.updateTokenmRealm(tokenRealm);
-
-
+
+
securityRealmMapperView.updateMappedRegexRealmMapper(mappedRegexRealmMapper);
securityRealmMapperView.updateSimpleRegexRealmMapper(simpleRegexRealmMapper);
securityRealmMapperView.updateCustomRealmMapper(customRealmMapper);
securityRealmMapperView.updateConstantRealmMapper(constantRealmMapper);
+
+ authenticationView.updateAuthenticationConfiguration(authConfiguration);
+ authenticationView.updateAuthenticationContext(authContext);
}
@Override