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.common.lib.to;
20  
21  import org.apache.commons.lang3.builder.EqualsBuilder;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  
24  public class SAML2IdPEntityTO extends SAML2EntityTO {
25  
26      private static final long serialVersionUID = 7215073386484048953L;
27  
28      public static class Builder extends SAML2EntityTO.Builder<SAML2IdPEntityTO, Builder> {
29  
30          @Override
31          protected SAML2IdPEntityTO newInstance() {
32              return new SAML2IdPEntityTO();
33          }
34  
35          public Builder metadata(final String metadata) {
36              getInstance().setMetadata(metadata);
37              return this;
38          }
39  
40          public Builder signingCertificate(final String signingCertificate) {
41              getInstance().setSigningCertificate(signingCertificate);
42              return this;
43          }
44  
45          public Builder signingKey(final String signingKey) {
46              getInstance().setSigningKey(signingKey);
47              return this;
48          }
49  
50          public Builder encryptionCertificate(final String encryptionCertificate) {
51              getInstance().setEncryptionCertificate(encryptionCertificate);
52              return this;
53          }
54  
55          public Builder encryptionKey(final String encryptionKey) {
56              getInstance().setEncryptionKey(encryptionKey);
57              return this;
58          }
59      }
60  
61      private String metadata;
62  
63      private String signingCertificate;
64  
65      private String signingKey;
66  
67      private String encryptionCertificate;
68  
69      private String encryptionKey;
70  
71      public String getMetadata() {
72          return metadata;
73      }
74  
75      public void setMetadata(final String metadata) {
76          this.metadata = metadata;
77      }
78  
79      public String getSigningCertificate() {
80          return signingCertificate;
81      }
82  
83      public void setSigningCertificate(final String signingCertificate) {
84          this.signingCertificate = signingCertificate;
85      }
86  
87      public String getSigningKey() {
88          return signingKey;
89      }
90  
91      public void setSigningKey(final String signingKey) {
92          this.signingKey = signingKey;
93      }
94  
95      public String getEncryptionCertificate() {
96          return encryptionCertificate;
97      }
98  
99      public void setEncryptionCertificate(final String encryptionCertificate) {
100         this.encryptionCertificate = encryptionCertificate;
101     }
102 
103     public String getEncryptionKey() {
104         return encryptionKey;
105     }
106 
107     public void setEncryptionKey(final String encryptionKey) {
108         this.encryptionKey = encryptionKey;
109     }
110 
111     @Override
112     public int hashCode() {
113         return new HashCodeBuilder().
114                 appendSuper(super.hashCode()).
115                 append(metadata).
116                 append(encryptionCertificate).
117                 append(encryptionKey).
118                 append(signingCertificate).
119                 append(signingKey).
120                 build();
121     }
122 
123     @Override
124     public boolean equals(final Object obj) {
125         if (this == obj) {
126             return true;
127         }
128         if (obj == null) {
129             return false;
130         }
131         if (getClass() != obj.getClass()) {
132             return false;
133         }
134         SAML2IdPEntityTO other = (SAML2IdPEntityTO) obj;
135         return new EqualsBuilder().
136                 appendSuper(super.equals(obj)).
137                 append(metadata, other.metadata).
138                 append(encryptionCertificate, other.encryptionCertificate).
139                 append(encryptionKey, other.encryptionKey).
140                 append(signingCertificate, other.signingCertificate).
141                 append(signingKey, other.signingKey).
142                 build();
143     }
144 }