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 java.util.List;
22  import org.apache.syncope.client.console.rest.ClientAppRestClient;
23  import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn;
24  import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
25  import org.apache.syncope.common.lib.types.AMEntitlement;
26  import org.apache.syncope.common.lib.types.ClientAppType;
27  import org.apache.wicket.PageReference;
28  import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
29  import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
30  import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
31  import org.apache.wicket.model.StringResourceModel;
32  
33  public class SAML2SPDirectoryPanel extends ClientAppDirectoryPanel<SAML2SPClientAppTO> {
34  
35      private static final long serialVersionUID = 7724172966123776889L;
36  
37      public SAML2SPDirectoryPanel(final String id, final ClientAppRestClient restClient, final PageReference pageRef) {
38          super(id, restClient, ClientAppType.SAML2SP, pageRef);
39  
40          SAML2SPClientAppTO defaultItem = new SAML2SPClientAppTO();
41  
42          addNewItemPanelBuilder(new ClientAppModalPanelBuilder<>(
43                  ClientAppType.SAML2SP,
44                  defaultItem,
45                  modal,
46                  policyRestClient,
47                  clientAppRestClient,
48                  realmRestClient,
49                  pageRef),
50                  true);
51          MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, AMEntitlement.CLIENTAPP_CREATE);
52  
53          initResultTable();
54      }
55  
56      @Override
57      protected void addCustomColumnFields(final List<IColumn<SAML2SPClientAppTO, String>> columns) {
58          columns.add(new PropertyColumn<>(new StringResourceModel("entityId", this), "entityId", "entityId"));
59          columns.add(new BooleanPropertyColumn<>(
60                  new StringResourceModel("signAssertions", this), "signAssertions", "signAssertions"));
61          columns.add(new BooleanPropertyColumn<>(
62                  new StringResourceModel("signResponses", this), "signResponses", "signResponses"));
63          columns.add(new BooleanPropertyColumn<>(
64                  new StringResourceModel("encryptionOptional", this), "encryptionOptional", "encryptionOptional"));
65          columns.add(new BooleanPropertyColumn<>(
66                  new StringResourceModel("encryptAssertions", this), "encryptAssertions", "encryptAssertions"));
67          columns.add(new PropertyColumn<>(
68                  new StringResourceModel("requiredNameIdFormat", this), "requiredNameIdFormat", "requiredNameIdFormat"));
69      }
70  }