View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.client.console.pages;
20  
21  import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
22  import java.util.ArrayList;
23  import java.util.List;
24  import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
25  import org.apache.syncope.client.console.panels.SAML2IdPsDirectoryPanel;
26  import org.apache.syncope.client.console.panels.SAML2SPPanel;
27  import org.apache.syncope.client.console.rest.SAML2IdPsRestClient;
28  import org.apache.syncope.client.console.rest.SAML2SPRestClient;
29  import org.apache.syncope.client.ui.commons.annotations.ExtPage;
30  import org.apache.syncope.common.lib.types.SAML2SP4UIEntitlement;
31  import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
32  import org.apache.wicket.extensions.markup.html.tabs.ITab;
33  import org.apache.wicket.markup.html.WebMarkupContainer;
34  import org.apache.wicket.markup.html.panel.Panel;
35  import org.apache.wicket.model.ResourceModel;
36  import org.apache.wicket.request.mapper.parameter.PageParameters;
37  import org.apache.wicket.spring.injection.annot.SpringBean;
38  
39  @ExtPage(label = "SAML 2.0 SP4UI", icon = "fas fa-sign-in-alt",
40          listEntitlement = SAML2SP4UIEntitlement.IDP_READ, priority = 400)
41  public class SAML2SP4UI extends BaseExtPage {
42  
43      private static final long serialVersionUID = -4837201407211278956L;
44  
45      @SpringBean
46      protected SAML2IdPsRestClient saml2IdPsRestClient;
47  
48      @SpringBean
49      protected SAML2SPRestClient saml2SPRestClient;
50  
51      public SAML2SP4UI(final PageParameters parameters) {
52          super(parameters);
53  
54          body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
55  
56          WebMarkupContainer content = new WebMarkupContainer("content");
57          content.setOutputMarkupId(true);
58          content.add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList()));
59          body.add(content);
60      }
61  
62      protected List<ITab> buildTabList() {
63          List<ITab> tabs = new ArrayList<>();
64  
65          tabs.add(new AbstractTab(new ResourceModel("idps")) {
66  
67              private static final long serialVersionUID = -6815067322125799251L;
68  
69              @Override
70              public Panel getPanel(final String panelId) {
71                  return new SAML2IdPsDirectoryPanel(panelId, saml2IdPsRestClient, getPageReference());
72              }
73          });
74  
75          tabs.add(new AbstractTab(new ResourceModel("sp")) {
76  
77              private static final long serialVersionUID = -6815067322125799251L;
78  
79              @Override
80              public Panel getPanel(final String panelId) {
81                  return new SAML2SPPanel(panelId, saml2SPRestClient);
82              }
83          });
84  
85          return tabs;
86      }
87  }