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.core.persistence.jpa.entity.am;
20  
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.Lob;
24  import javax.persistence.Table;
25  import org.apache.commons.lang3.ArrayUtils;
26  import org.apache.syncope.core.persistence.api.entity.am.SAML2IdPEntity;
27  import org.apache.syncope.core.persistence.jpa.entity.AbstractProvidedKeyEntity;
28  
29  @Entity
30  @Table(name = JPASAML2IdPEntity.TABLE)
31  public class JPASAML2IdPEntity extends AbstractProvidedKeyEntity implements SAML2IdPEntity {
32  
33      public static final String TABLE = "SAML2IdPEntity";
34  
35      private static final long serialVersionUID = 57352617217394093L;
36  
37      @Column(nullable = false)
38      @Lob
39      private byte[] metadata;
40  
41      @Lob
42      private byte[] signingCertificate;
43  
44      @Lob
45      private byte[] signingKey;
46  
47      @Lob
48      private byte[] encryptionCertificate;
49  
50      @Lob
51      private byte[] encryptionKey;
52  
53      @Override
54      public byte[] getMetadata() {
55          return metadata;
56      }
57  
58      @Override
59      public void setMetadata(final byte[] metadata) {
60          this.metadata = ArrayUtils.clone(metadata);
61      }
62  
63      @Override
64      public byte[] getSigningCertificate() {
65          return signingCertificate;
66      }
67  
68      @Override
69      public void setSigningCertificate(final byte[] signingCertificate) {
70          this.signingCertificate = ArrayUtils.clone(signingCertificate);
71      }
72  
73      @Override
74      public byte[] getSigningKey() {
75          return signingKey;
76      }
77  
78      @Override
79      public void setSigningKey(final byte[] signingKey) {
80          this.signingKey = ArrayUtils.clone(signingKey);
81      }
82  
83      @Override
84      public byte[] getEncryptionCertificate() {
85          return encryptionCertificate;
86      }
87  
88      @Override
89      public void setEncryptionCertificate(final byte[] encryptionCertificate) {
90          this.encryptionCertificate = ArrayUtils.clone(encryptionCertificate);
91      }
92  
93      @Override
94      public byte[] getEncryptionKey() {
95          return encryptionKey;
96      }
97  
98      @Override
99      public void setEncryptionKey(final byte[] encryptionKey) {
100         this.encryptionKey = ArrayUtils.clone(encryptionKey);
101     }
102 }