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.spring.security;
20  
21  import com.nimbusds.jose.JWSAlgorithm;
22  import org.apache.syncope.common.lib.types.CipherAlgorithm;
23  import org.springframework.boot.context.properties.ConfigurationProperties;
24  
25  @ConfigurationProperties("security")
26  public class SecurityProperties {
27  
28      public static class DigesterProperties {
29  
30          private int saltIterations = 1;
31  
32          private int saltSizeBytes = 8;
33  
34          private boolean invertPositionOfPlainSaltInEncryptionResults = true;
35  
36          private boolean invertPositionOfSaltInMessageBeforeDigesting = true;
37  
38          private boolean useLenientSaltSizeCheck = true;
39  
40          public int getSaltIterations() {
41              return saltIterations;
42          }
43  
44          public void setSaltIterations(final int saltIterations) {
45              this.saltIterations = saltIterations;
46          }
47  
48          public int getSaltSizeBytes() {
49              return saltSizeBytes;
50          }
51  
52          public void setSaltSizeBytes(final int saltSizeBytes) {
53              this.saltSizeBytes = saltSizeBytes;
54          }
55  
56          public boolean isInvertPositionOfPlainSaltInEncryptionResults() {
57              return invertPositionOfPlainSaltInEncryptionResults;
58          }
59  
60          public void setInvertPositionOfPlainSaltInEncryptionResults(
61                  final boolean invertPositionOfPlainSaltInEncryptionResults) {
62  
63              this.invertPositionOfPlainSaltInEncryptionResults = invertPositionOfPlainSaltInEncryptionResults;
64          }
65  
66          public boolean isInvertPositionOfSaltInMessageBeforeDigesting() {
67              return invertPositionOfSaltInMessageBeforeDigesting;
68          }
69  
70          public void setInvertPositionOfSaltInMessageBeforeDigesting(
71                  final boolean invertPositionOfSaltInMessageBeforeDigesting) {
72  
73              this.invertPositionOfSaltInMessageBeforeDigesting = invertPositionOfSaltInMessageBeforeDigesting;
74          }
75  
76          public boolean isUseLenientSaltSizeCheck() {
77              return useLenientSaltSizeCheck;
78          }
79  
80          public void setUseLenientSaltSizeCheck(final boolean useLenientSaltSizeCheck) {
81              this.useLenientSaltSizeCheck = useLenientSaltSizeCheck;
82          }
83      }
84  
85      private String adminUser;
86  
87      private String adminPassword;
88  
89      private CipherAlgorithm adminPasswordAlgorithm;
90  
91      private String anonymousUser;
92  
93      private String anonymousKey;
94  
95      private String jwtIssuer = "ApacheSyncope";
96  
97      private String jwsKey;
98  
99      private String jwsAlgorithm = JWSAlgorithm.HS512.getName();
100 
101     private String secretKey;
102 
103     private final DigesterProperties digester = new DigesterProperties();
104 
105     public String getAdminUser() {
106         return adminUser;
107     }
108 
109     public void setAdminUser(final String adminUser) {
110         this.adminUser = adminUser;
111     }
112 
113     public String getAdminPassword() {
114         return adminPassword;
115     }
116 
117     public void setAdminPassword(final String adminPassword) {
118         this.adminPassword = adminPassword;
119     }
120 
121     public CipherAlgorithm getAdminPasswordAlgorithm() {
122         return adminPasswordAlgorithm;
123     }
124 
125     public void setAdminPasswordAlgorithm(final CipherAlgorithm adminPasswordAlgorithm) {
126         this.adminPasswordAlgorithm = adminPasswordAlgorithm;
127     }
128 
129     public String getAnonymousUser() {
130         return anonymousUser;
131     }
132 
133     public void setAnonymousUser(final String anonymousUser) {
134         this.anonymousUser = anonymousUser;
135     }
136 
137     public String getAnonymousKey() {
138         return anonymousKey;
139     }
140 
141     public void setAnonymousKey(final String anonymousKey) {
142         this.anonymousKey = anonymousKey;
143     }
144 
145     public String getJwtIssuer() {
146         return jwtIssuer;
147     }
148 
149     public void setJwtIssuer(final String jwtIssuer) {
150         this.jwtIssuer = jwtIssuer;
151     }
152 
153     public String getJwsKey() {
154         return jwsKey;
155     }
156 
157     public void setJwsKey(final String jwsKey) {
158         this.jwsKey = jwsKey;
159     }
160 
161     public String getJwsAlgorithm() {
162         return jwsAlgorithm;
163     }
164 
165     public void setJwsAlgorithm(final String jwsAlgorithm) {
166         this.jwsAlgorithm = jwsAlgorithm;
167     }
168 
169     public String getSecretKey() {
170         return secretKey;
171     }
172 
173     public void setSecretKey(final String secretKey) {
174         this.secretKey = secretKey;
175     }
176 
177     public DigesterProperties getDigester() {
178         return digester;
179     }
180 }