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.clientapps;
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.rest.ClientAppRestClient;
25  import org.apache.syncope.common.lib.types.ClientAppType;
26  import org.apache.wicket.PageReference;
27  import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
28  import org.apache.wicket.extensions.markup.html.tabs.ITab;
29  import org.apache.wicket.markup.html.panel.Panel;
30  import org.apache.wicket.model.Model;
31  import org.apache.wicket.spring.injection.annot.SpringBean;
32  
33  public class ClientApps extends Panel {
34  
35      private static final long serialVersionUID = 5755172996408318813L;
36  
37      @SpringBean
38      protected ClientAppRestClient clientAppRestClient;
39  
40      public ClientApps(final String id, final PageReference pageRef) {
41          super(id);
42  
43          add(new AjaxBootstrapTabbedPanel<>("clientApps", buildTabList(pageRef)));
44      }
45  
46      protected List<ITab> buildTabList(final PageReference pageRef) {
47          List<ITab> tabs = new ArrayList<>(3);
48  
49          tabs.add(new AbstractTab(Model.of(ClientAppType.CASSP.name())) {
50  
51              private static final long serialVersionUID = 5211692813425391144L;
52  
53              @Override
54              public Panel getPanel(final String panelId) {
55                  return new CASSPDirectoryPanel(panelId, clientAppRestClient, pageRef);
56              }
57          });
58  
59          tabs.add(new AbstractTab(Model.of(ClientAppType.SAML2SP.name())) {
60  
61              private static final long serialVersionUID = 5211692813425391144L;
62  
63              @Override
64              public Panel getPanel(final String panelId) {
65                  return new SAML2SPDirectoryPanel(panelId, clientAppRestClient, pageRef);
66              }
67          });
68  
69          tabs.add(new AbstractTab(Model.of(ClientAppType.OIDCRP.name())) {
70  
71              private static final long serialVersionUID = 5211692813425391144L;
72  
73              @Override
74              public Panel getPanel(final String panelId) {
75                  return new OIDCRPDirectoryPanel(panelId, clientAppRestClient, pageRef);
76              }
77          });
78  
79          return tabs;
80      }
81  }