blob: 175202a13218d70f2f7a2a4343535f402e7b012d [file] [log] [blame]
margaretha56e8e552017-12-05 16:31:21 +01001package de.ids_mannheim.korap.config;
2
margaretha19295962018-06-26 16:00:47 +02003import java.io.File;
margaretha56e8e552017-12-05 16:31:21 +01004import java.io.IOException;
margaretha5225ed02018-06-25 18:38:40 +02005import java.io.InputStream;
margaretha5225ed02018-06-25 18:38:40 +02006import java.net.MalformedURLException;
7import java.net.URI;
8import java.net.URISyntaxException;
9import java.net.URL;
margaretha19295962018-06-26 16:00:47 +020010import java.nio.charset.Charset;
margaretha5225ed02018-06-25 18:38:40 +020011import java.security.interfaces.RSAPrivateKey;
margaretha19295962018-06-26 16:00:47 +020012import java.text.ParseException;
margarethadfecb4b2017-12-12 19:32:30 +010013import java.util.ArrayList;
margarethab4ce6602018-04-26 20:23:57 +020014import java.util.Arrays;
margarethadfecb4b2017-12-12 19:32:30 +010015import java.util.List;
margaretha56e8e552017-12-05 16:31:21 +010016import java.util.Properties;
margarethab4ce6602018-04-26 20:23:57 +020017import java.util.Set;
margaretha56e8e552017-12-05 16:31:21 +010018import java.util.regex.Pattern;
margarethab4ce6602018-04-26 20:23:57 +020019import java.util.stream.Collectors;
margaretha56e8e552017-12-05 16:31:21 +010020
margaretha14686b52021-07-26 15:24:16 +020021import org.apache.logging.log4j.LogManager;
22import org.apache.logging.log4j.Logger;
23
margaretha19295962018-06-26 16:00:47 +020024import com.nimbusds.jose.JOSEException;
25import com.nimbusds.jose.jwk.JWK;
26import com.nimbusds.jose.jwk.JWKSet;
27import com.nimbusds.jose.jwk.RSAKey;
28import com.nimbusds.jose.util.IOUtils;
margaretha5225ed02018-06-25 18:38:40 +020029
margaretha6374f722018-04-17 18:45:57 +020030import de.ids_mannheim.korap.constant.AuthenticationMethod;
margaretha6d61a552018-04-10 19:26:44 +020031import de.ids_mannheim.korap.interfaces.EncryptionIface;
margaretha9c78e1a2018-06-27 14:12:35 +020032import de.ids_mannheim.korap.oauth2.openid.OpenIdConfiguration;
margaretha064eb6f2018-07-10 18:33:01 +020033import de.ids_mannheim.korap.utils.TimeUtils;
margaretha14686b52021-07-26 15:24:16 +020034import net.sf.ehcache.Cache;
35import net.sf.ehcache.CacheManager;
36import net.sf.ehcache.config.CacheConfiguration;
margaretha6d61a552018-04-10 19:26:44 +020037
margarethab4ce6602018-04-26 20:23:57 +020038/**
39 * Configuration for Kustvakt full version including properties
margaretha19295962018-06-26 16:00:47 +020040 * concerning authentication and licenses.
margaretha56e8e552017-12-05 16:31:21 +010041 *
42 * @author margaretha
43 *
44 */
margarethadfecb4b2017-12-12 19:32:30 +010045
margaretha2afb97d2017-12-07 19:18:44 +010046public class FullConfiguration extends KustvaktConfiguration {
margaretha14686b52021-07-26 15:24:16 +020047 public static Logger jlog = LogManager.getLogger(FullConfiguration.class);
margaretha58e18632018-02-15 13:04:42 +010048 // mail configuration
49 private boolean isMailEnabled;
50 private String testEmail;
margarethaaecee1b2018-02-20 14:44:21 +010051 private String noReply;
margaretha7d0165c2018-02-26 15:31:37 +010052 private String emailAddressRetrieval;
margaretha6b3ecdd2018-03-01 18:23:56 +010053
margarethaa86b1412018-02-21 20:40:35 +010054 private String groupInvitationTemplate;
margaretha6b3ecdd2018-03-01 18:23:56 +010055
margaretha56e8e552017-12-05 16:31:21 +010056 private String ldapConfig;
57
58 private String freeOnlyRegex;
59 private String publicOnlyRegex;
60 private String allOnlyRegex;
61
margarethadfecb4b2017-12-12 19:32:30 +010062 private List<String> freeRegexList;
63 private List<String> publicRegexList;
64 private List<String> allRegexList;
65
margaretha56e8e552017-12-05 16:31:21 +010066 private String authenticationScheme;
67
margaretha2c019fa2018-02-01 19:50:51 +010068 private boolean isSoftDeleteAutoGroup;
69 private boolean isSoftDeleteGroup;
70 private boolean isSoftDeleteGroupMember;
71
margaretha33fa3d92018-07-26 13:50:17 +020072 private EncryptionIface.Encryption secureHashAlgorithm;
margaretha6374f722018-04-17 18:45:57 +020073
74 private AuthenticationMethod OAuth2passwordAuthentication;
75 private String nativeClientHost;
margarethabe4c5c92018-05-03 18:55:49 +020076 private Set<String> defaultAccessScopes;
77 private Set<String> clientCredentialsScopes;
margarethab4ce6602018-04-26 20:23:57 +020078 private int maxAuthenticationAttempts;
margaretha6374f722018-04-17 18:45:57 +020079
margaretha0afd44a2020-02-05 10:49:21 +010080 private int accessTokenLongExpiry;
margaretha064eb6f2018-07-10 18:33:01 +020081 private int accessTokenExpiry;
margarethad7163122022-04-11 09:42:41 +020082 private int refreshTokenLongExpiry;
margaretha064eb6f2018-07-10 18:33:01 +020083 private int refreshTokenExpiry;
84 private int authorizationCodeExpiry;
margaretha9e73c0e2023-05-05 16:51:49 +020085
86 private int maxNumberOfUserQueries;
87
margaretha5225ed02018-06-25 18:38:40 +020088 private URL issuer;
89 private URI issuerURI;
margaretha9c78e1a2018-06-27 14:12:35 +020090 private OpenIdConfiguration openidConfig;
91
margaretha5225ed02018-06-25 18:38:40 +020092 private RSAPrivateKey rsaPrivateKey;
margaretha19295962018-06-26 16:00:47 +020093 private JWKSet publicKeySet;
94 private String rsaKeyId;
margaretha339fd2e2018-11-13 12:14:53 +010095
margaretha1b320452018-08-02 16:56:25 +020096 private String namedVCPath;
margaretha3181b8d2022-05-31 11:51:47 +020097
98 private boolean createInitialSuperClient;
margaretha5225ed02018-06-25 18:38:40 +020099
margaretha19295962018-06-26 16:00:47 +0200100 public FullConfiguration (Properties properties) throws Exception {
margaretha56e8e552017-12-05 16:31:21 +0100101 super(properties);
102 }
margaretha3d55b002019-03-19 12:00:44 +0100103
104 public FullConfiguration () {
105 super();
106 }
margaretha56e8e552017-12-05 16:31:21 +0100107
108 @Override
margaretha19295962018-06-26 16:00:47 +0200109 public void load (Properties properties) throws Exception {
margaretha56e8e552017-12-05 16:31:21 +0100110
111 super.load(properties);
112 // EM: regex used for storing vc
113 setLicenseRegex(properties);
114
115 // EM: pattern for matching availability in Krill matches
116 setLicensePatterns(properties);
margaretha2c019fa2018-02-01 19:50:51 +0100117 setDeleteConfiguration(properties);
margaretha58e18632018-02-15 13:04:42 +0100118 setMailConfiguration(properties);
margaretha2afb97d2017-12-07 19:18:44 +0100119 ldapConfig = properties.getProperty("ldap.config");
margaretha58e18632018-02-15 13:04:42 +0100120
margaretha33fa3d92018-07-26 13:50:17 +0200121 setSecurityConfiguration(properties);
margaretha6374f722018-04-17 18:45:57 +0200122 setOAuth2Configuration(properties);
margaretha5225ed02018-06-25 18:38:40 +0200123 setOpenIdConfiguration(properties);
margaretha19295962018-06-26 16:00:47 +0200124 setRSAKeys(properties);
margaretha339fd2e2018-11-13 12:14:53 +0100125
126 setNamedVCPath(properties.getProperty("krill.namedVC", ""));
margaretha14686b52021-07-26 15:24:16 +0200127
128 Cache cache = CacheManager.newInstance().getCache("named_vc");
129 CacheConfiguration config = cache.getCacheConfiguration();
130 config.setMaxBytesLocalHeap(properties.getProperty("cache.max.bytes.local.heap", "256m"));
131 config.setMaxBytesLocalDisk(properties.getProperty("cache.max.bytes.local.disk", "2G"));
132 jlog.info("max local heap:"+config.getMaxBytesLocalHeapAsString());
133 jlog.info("max local disk:"+config.getMaxBytesLocalDiskAsString());
margaretha9e73c0e2023-05-05 16:51:49 +0200134
135 setMaxNumberOfUserQueries(Integer.parseInt(
136 properties.getProperty("max.user.persistent.queries", "20")));
margaretha19295962018-06-26 16:00:47 +0200137 }
138
margaretha33fa3d92018-07-26 13:50:17 +0200139 private void setSecurityConfiguration (Properties properties) {
140 setSecureHashAlgorithm(Enum.valueOf(EncryptionIface.Encryption.class,
141 properties.getProperty("security.secure.hash.algorithm",
142 "BCRYPT")));
margaretha33fa3d92018-07-26 13:50:17 +0200143 }
144
margaretha9c78e1a2018-06-27 14:12:35 +0200145 private void setOpenIdConfiguration (Properties properties)
146 throws URISyntaxException, MalformedURLException {
147 String issuerStr = properties.getProperty("security.jwt.issuer",
148 "https://korap.ids-mannheim.de");
149
150 if (!issuerStr.startsWith("http")) {
151 issuerStr = "http://" + issuerStr;
152 }
153 setIssuer(new URL(issuerStr));
154 setIssuerURI(issuer.toURI());
155
156 issuerStr = issuerURI.toString();
157
158 OpenIdConfiguration openidConfig = new OpenIdConfiguration();
159 openidConfig.setIssuer(issuerStr);
160 openidConfig.setJwks_uri(issuerStr + OpenIdConfiguration.JWKS_ENDPOINT);
161 openidConfig.setRegistration_endpoint(
162 issuerStr + OpenIdConfiguration.CLIENT_REGISTRATION_ENDPOINT);
163 openidConfig.setAuthorization_endpoint(
164 issuerStr + OpenIdConfiguration.AUTHORIZATION_ENDPOINT);
165 openidConfig.setToken_endpoint(
166 issuerStr + OpenIdConfiguration.TOKEN_ENDPOINT);
167
168 String grantTypes = properties.getProperty("openid.grant.types", "");
169 openidConfig.setGrant_types_supported(grantTypes.split(" "));
170
171 String responseTypes =
172 properties.getProperty("openid.response.types", "code");
173 openidConfig.setResponse_types_supported(responseTypes.split(" "));
174
175 String responseModes =
176 properties.getProperty("openid.response.modes", "");
177 openidConfig.setResponse_modes_supported(responseModes.split(" "));
178
179 String clientAuthMethods =
180 properties.getProperty("openid.client.auth.methods", "");
181 openidConfig.setToken_endpoint_auth_methods_supported(
182 clientAuthMethods.split(" "));
183
184 String tokenSigningAlgorithms = properties
185 .getProperty("openid.token.signing.algorithms", "RS256");
186 openidConfig.setToken_endpoint_auth_signing_alg_values_supported(
187 tokenSigningAlgorithms.split(" "));
188
189 String subjectTypes =
190 properties.getProperty("openid.subject.types", "public");
191 openidConfig.setSubject_types_supported(subjectTypes.split(" "));
192
193 String displayTypes =
194 properties.getProperty("openid.display.types", "");
195 openidConfig.setDisplay_values_supported(displayTypes.split(" "));
196
197 String supportedScopes =
198 properties.getProperty("openid.supported.scopes", "");
199 openidConfig.setScopes_supported(supportedScopes.split(" "));
200
201 String claimTypes =
202 properties.getProperty("openid.claim.types", "normal");
203 openidConfig.setClaim_types_supported(claimTypes.split(" "));
204
205 String supportedClaims =
206 properties.getProperty("openid.supported.claims", "");
207 openidConfig.setClaims_supported(supportedClaims.split(" "));
208
209 String claimLocales =
210 properties.getProperty("openid.supported.claim.locales", "");
211 openidConfig.setClaims_locales_supported(claimLocales.split(" "));
212
213 String uiLocales = properties.getProperty("openid.ui.locales", "en");
214 openidConfig.setUi_locales_supported(uiLocales.split(" "));
215
216 boolean supportClaimParam = Boolean.getBoolean(
217 properties.getProperty("openid.support.claim.param", "false"));
218 openidConfig.setClaims_parameter_supported(supportClaimParam);
219
220 openidConfig.setRequest_parameter_supported(false);
221 openidConfig.setRequest_uri_parameter_supported(false);
222 openidConfig.setRequire_request_uri_registration(false);
223 openidConfig.setMutual_tls_sender_constrained_access_tokens(false);
224
225 String privacyPolicy =
226 properties.getProperty("openid.privacy.policy", "");
227 openidConfig.setOp_policy_uri(privacyPolicy);
228
229 String termOfService =
230 properties.getProperty("openid.term.of.service", "");
231 openidConfig.setOp_tos_uri(termOfService);
232
233 String serviceDocURL = properties.getProperty("openid.service.doc", "");
234 openidConfig.setService_documentation(serviceDocURL);
235 this.setOpenidConfig(openidConfig);
236 }
237
margaretha19295962018-06-26 16:00:47 +0200238 private void setRSAKeys (Properties properties)
239 throws IOException, ParseException, JOSEException {
240 setRsaKeyId(properties.getProperty("rsa.key.id", ""));
241
margarethad7cab212018-07-02 19:01:43 +0200242 String rsaPublic = properties.getProperty("rsa.public", null);
243 setPublicKeySet(rsaPublic);
margaretha19295962018-06-26 16:00:47 +0200244
margarethad7cab212018-07-02 19:01:43 +0200245 String rsaPrivate = properties.getProperty("rsa.private", null);
246 setRsaPrivateKey(rsaPrivate);
margaretha5225ed02018-06-25 18:38:40 +0200247 }
248
margaretha6374f722018-04-17 18:45:57 +0200249 private void setOAuth2Configuration (Properties properties) {
250 setOAuth2passwordAuthentication(
margarethab4ce6602018-04-26 20:23:57 +0200251 Enum.valueOf(AuthenticationMethod.class, properties.getProperty(
252 "oauth2.password.authentication", "TEST")));
253 setNativeClientHost(properties.getProperty("oauth2.native.client.host",
margaretha6374f722018-04-17 18:45:57 +0200254 "korap.ids-mannheim.de"));
margaretha3181b8d2022-05-31 11:51:47 +0200255 setCreateInitialSuperClient(Boolean.valueOf(
256 properties.getProperty("oauth2.initial.super.client", "false")));
margarethab4ce6602018-04-26 20:23:57 +0200257
258 setMaxAuthenticationAttempts(Integer
margaretha064eb6f2018-07-10 18:33:01 +0200259 .parseInt(properties.getProperty("oauth2.max.attempts", "1")));
margarethab4ce6602018-04-26 20:23:57 +0200260
261 String scopes = properties.getProperty("oauth2.default.scopes",
margaretha9c78e1a2018-06-27 14:12:35 +0200262 "openid preferred_username");
margarethab4ce6602018-04-26 20:23:57 +0200263 Set<String> scopeSet =
264 Arrays.stream(scopes.split(" ")).collect(Collectors.toSet());
margarethabe4c5c92018-05-03 18:55:49 +0200265 setDefaultAccessScopes(scopeSet);
266
margarethad7cab212018-07-02 19:01:43 +0200267 String clientScopes = properties
268 .getProperty("oauth2.client.credentials.scopes", "client_info");
margarethabe4c5c92018-05-03 18:55:49 +0200269 setClientCredentialsScopes(Arrays.stream(clientScopes.split(" "))
270 .collect(Collectors.toSet()));
margaretha064eb6f2018-07-10 18:33:01 +0200271
272 accessTokenExpiry = TimeUtils.convertTimeToSeconds(
273 properties.getProperty("oauth2.access.token.expiry", "1D"));
274 refreshTokenExpiry = TimeUtils.convertTimeToSeconds(
275 properties.getProperty("oauth2.refresh.token.expiry", "90D"));
276 authorizationCodeExpiry = TimeUtils.convertTimeToSeconds(properties
277 .getProperty("oauth2.authorization.code.expiry", "10M"));
margaretha0afd44a2020-02-05 10:49:21 +0100278
279 setAccessTokenLongExpiry(TimeUtils.convertTimeToSeconds(
280 properties.getProperty("oauth2.access.token.long.expiry", "365D")));
margarethad7163122022-04-11 09:42:41 +0200281 setRefreshTokenLongExpiry(TimeUtils.convertTimeToSeconds(
282 properties.getProperty("oauth2.refresh.token.long.expiry", "365D")));
margaretha58e18632018-02-15 13:04:42 +0100283 }
284
285 private void setMailConfiguration (Properties properties) {
margaretha6b3ecdd2018-03-01 18:23:56 +0100286 setMailEnabled(Boolean
287 .valueOf(properties.getProperty("mail.enabled", "false")));
288 if (isMailEnabled) {
margaretha58e18632018-02-15 13:04:42 +0100289 // other properties must be set in the kustvakt.conf
margaretha6b3ecdd2018-03-01 18:23:56 +0100290 setTestEmail(
291 properties.getProperty("mail.receiver", "test@localhost"));
margarethaaecee1b2018-02-20 14:44:21 +0100292 setNoReply(properties.getProperty("mail.sender"));
margaretha6b3ecdd2018-03-01 18:23:56 +0100293 setGroupInvitationTemplate(
294 properties.getProperty("template.group.invitation"));
295 setEmailAddressRetrieval(
296 properties.getProperty("mail.address.retrieval", "test"));
margaretha58e18632018-02-15 13:04:42 +0100297 }
margaretha56e8e552017-12-05 16:31:21 +0100298 }
299
margaretha2c019fa2018-02-01 19:50:51 +0100300 private void setDeleteConfiguration (Properties properties) {
margaretha58e18632018-02-15 13:04:42 +0100301 setSoftDeleteGroup(
302 parseDeleteConfig(properties.getProperty("delete.group", "")));
303 setSoftDeleteAutoGroup(parseDeleteConfig(
304 properties.getProperty("delete.auto.group", "")));
margaretha2c019fa2018-02-01 19:50:51 +0100305 setSoftDeleteGroupMember(parseDeleteConfig(
306 properties.getProperty("delete.group.member", "")));
307 }
308
309 private boolean parseDeleteConfig (String deleteConfig) {
310 return deleteConfig.equals("soft") ? true : false;
311 }
312
margaretha56e8e552017-12-05 16:31:21 +0100313 private void setLicensePatterns (Properties properties) {
margaretha979a2e62017-12-12 19:47:04 +0100314 setFreeLicensePattern(compilePattern(getFreeOnlyRegex()));
margaretha2c019fa2018-02-01 19:50:51 +0100315 setPublicLicensePattern(compilePattern(
316 getFreeOnlyRegex() + "|" + getPublicOnlyRegex()));
317 setAllLicensePattern(compilePattern(getFreeOnlyRegex() + "|"
318 + getPublicOnlyRegex() + "|" + getAllOnlyRegex()));
margaretha56e8e552017-12-05 16:31:21 +0100319 }
320
321 private void setLicenseRegex (Properties properties) {
margaretha979a2e62017-12-12 19:47:04 +0100322 setFreeOnlyRegex(properties.getProperty("availability.regex.free", ""));
323 freeRegexList = splitAndAddToList(getFreeOnlyRegex());
margarethadfecb4b2017-12-12 19:32:30 +0100324
margaretha2c019fa2018-02-01 19:50:51 +0100325 setPublicOnlyRegex(
326 properties.getProperty("availability.regex.public", ""));
margaretha979a2e62017-12-12 19:47:04 +0100327 publicRegexList = splitAndAddToList(getPublicOnlyRegex());
margarethadfecb4b2017-12-12 19:32:30 +0100328
margaretha979a2e62017-12-12 19:47:04 +0100329 setAllOnlyRegex(properties.getProperty("availability.regex.all", ""));
330 allRegexList = splitAndAddToList(getAllOnlyRegex());
margarethadfecb4b2017-12-12 19:32:30 +0100331 }
332
333 private List<String> splitAndAddToList (String regex) {
334 List<String> list;
335 if (regex.contains("|")) {
336 String[] regexes = regex.split("\\|");
337 list = new ArrayList<>(regexes.length);
338 for (String s : regexes) {
339 list.add(s.trim());
340 }
341 }
margaretha2c019fa2018-02-01 19:50:51 +0100342 else {
margarethadfecb4b2017-12-12 19:32:30 +0100343 list = new ArrayList<>(1);
344 list.add(regex);
345 }
346 return list;
margaretha56e8e552017-12-05 16:31:21 +0100347 }
348
margaretha56e8e552017-12-05 16:31:21 +0100349 private Pattern compilePattern (String patternStr) {
350 if (!patternStr.isEmpty()) {
351 return Pattern.compile(patternStr);
352 }
353 else {
354 return null;
355 }
356 }
357
margarethadfecb4b2017-12-12 19:32:30 +0100358 public String getLdapConfig () {
359 return ldapConfig;
360 }
361
362 public Pattern getPublicLicensePattern () {
363 return publicLicensePattern;
364 }
365
366 public void setPublicLicensePattern (Pattern publicLicensePattern) {
367 this.publicLicensePattern = publicLicensePattern;
368 }
369
370 public Pattern getFreeLicensePattern () {
371 return freeLicensePattern;
372 }
373
374 public void setFreeLicensePattern (Pattern freeLicensePattern) {
375 this.freeLicensePattern = freeLicensePattern;
376 }
377
378 public Pattern getAllLicensePattern () {
379 return allLicensePattern;
380 }
381
382 public void setAllLicensePattern (Pattern allLicensePattern) {
383 this.allLicensePattern = allLicensePattern;
384 }
385
386 public String getAuthenticationScheme () {
387 return authenticationScheme;
388 }
389
390 public void setAuthenticationScheme (String authenticationScheme) {
391 this.authenticationScheme = authenticationScheme;
392 }
393
394 public List<String> getFreeRegexList () {
395 return freeRegexList;
396 }
397
398 public void setFreeRegexList (List<String> freeRegexList) {
399 this.freeRegexList = freeRegexList;
400 }
401
402 public List<String> getPublicRegexList () {
403 return publicRegexList;
404 }
405
406 public void setPublicRegexList (List<String> publicRegexList) {
407 this.publicRegexList = publicRegexList;
408 }
409
410 public List<String> getAllRegexList () {
411 return allRegexList;
412 }
413
414 public void setAllRegexList (List<String> allRegexList) {
415 this.allRegexList = allRegexList;
416 }
417
margaretha979a2e62017-12-12 19:47:04 +0100418 public String getFreeOnlyRegex () {
419 return freeOnlyRegex;
420 }
421
422 public void setFreeOnlyRegex (String freeOnlyRegex) {
423 this.freeOnlyRegex = freeOnlyRegex;
424 }
425
426 public String getPublicOnlyRegex () {
427 return publicOnlyRegex;
428 }
429
430 public void setPublicOnlyRegex (String publicOnlyRegex) {
431 this.publicOnlyRegex = publicOnlyRegex;
432 }
433
434 public String getAllOnlyRegex () {
435 return allOnlyRegex;
436 }
437
438 public void setAllOnlyRegex (String allOnlyRegex) {
439 this.allOnlyRegex = allOnlyRegex;
440 }
441
margaretha2c019fa2018-02-01 19:50:51 +0100442 public boolean isSoftDeleteGroup () {
443 return isSoftDeleteGroup;
444 }
445
446 public void setSoftDeleteGroup (boolean isSoftDeleteGroup) {
447 this.isSoftDeleteGroup = isSoftDeleteGroup;
448 }
449
450 public boolean isSoftDeleteGroupMember () {
451 return isSoftDeleteGroupMember;
452 }
453
454 public void setSoftDeleteGroupMember (boolean isSoftDeleteGroupMember) {
455 this.isSoftDeleteGroupMember = isSoftDeleteGroupMember;
456 }
457
458 public boolean isSoftDeleteAutoGroup () {
459 return isSoftDeleteAutoGroup;
460 }
461
462 public void setSoftDeleteAutoGroup (boolean isSoftDeleteAutoGroup) {
463 this.isSoftDeleteAutoGroup = isSoftDeleteAutoGroup;
464 }
465
margaretha58e18632018-02-15 13:04:42 +0100466 public String getTestEmail () {
467 return testEmail;
468 }
469
470 public void setTestEmail (String testEmail) {
471 this.testEmail = testEmail;
472 }
473
margaretha58e18632018-02-15 13:04:42 +0100474 public boolean isMailEnabled () {
475 return isMailEnabled;
476 }
477
478 public void setMailEnabled (boolean isMailEnabled) {
479 this.isMailEnabled = isMailEnabled;
480 }
481
margarethaaecee1b2018-02-20 14:44:21 +0100482 public String getNoReply () {
483 return noReply;
484 }
485
486 public void setNoReply (String noReply) {
487 this.noReply = noReply;
488 }
489
margarethaa86b1412018-02-21 20:40:35 +0100490 public String getGroupInvitationTemplate () {
491 return groupInvitationTemplate;
492 }
493
494 public void setGroupInvitationTemplate (String groupInvitationTemplate) {
495 this.groupInvitationTemplate = groupInvitationTemplate;
496 }
497
margaretha7d0165c2018-02-26 15:31:37 +0100498 public String getEmailAddressRetrieval () {
499 return emailAddressRetrieval;
500 }
501
502 public void setEmailAddressRetrieval (String emailAddressRetrieval) {
503 this.emailAddressRetrieval = emailAddressRetrieval;
504 }
505
margaretha33fa3d92018-07-26 13:50:17 +0200506 public EncryptionIface.Encryption getSecureHashAlgorithm () {
507 return secureHashAlgorithm;
margaretha6d61a552018-04-10 19:26:44 +0200508 }
509
margaretha33fa3d92018-07-26 13:50:17 +0200510 public void setSecureHashAlgorithm (
511 EncryptionIface.Encryption secureHashAlgorithm) {
512 this.secureHashAlgorithm = secureHashAlgorithm;
margaretha6d61a552018-04-10 19:26:44 +0200513 }
514
margaretha6374f722018-04-17 18:45:57 +0200515 public AuthenticationMethod getOAuth2passwordAuthentication () {
516 return OAuth2passwordAuthentication;
517 }
518
519 public void setOAuth2passwordAuthentication (
520 AuthenticationMethod oAuth2passwordAuthentication) {
521 OAuth2passwordAuthentication = oAuth2passwordAuthentication;
522 }
523
524 public String getNativeClientHost () {
525 return nativeClientHost;
526 }
527
528 public void setNativeClientHost (String nativeClientHost) {
529 this.nativeClientHost = nativeClientHost;
530 }
531
margarethab4ce6602018-04-26 20:23:57 +0200532 public int getMaxAuthenticationAttempts () {
533 return maxAuthenticationAttempts;
534 }
535
536 public void setMaxAuthenticationAttempts (int maxAuthenticationAttempts) {
537 this.maxAuthenticationAttempts = maxAuthenticationAttempts;
538 }
539
margarethabe4c5c92018-05-03 18:55:49 +0200540 public Set<String> getDefaultAccessScopes () {
541 return defaultAccessScopes;
margarethab4ce6602018-04-26 20:23:57 +0200542 }
543
margarethabe4c5c92018-05-03 18:55:49 +0200544 public void setDefaultAccessScopes (Set<String> accessScopes) {
545 this.defaultAccessScopes = accessScopes;
546 }
547
548 public Set<String> getClientCredentialsScopes () {
549 return clientCredentialsScopes;
550 }
551
552 public void setClientCredentialsScopes (
553 Set<String> clientCredentialsScopes) {
554 this.clientCredentialsScopes = clientCredentialsScopes;
margarethab4ce6602018-04-26 20:23:57 +0200555 }
556
margaretha5225ed02018-06-25 18:38:40 +0200557 public URL getIssuer () {
558 return issuer;
559 }
560
561 public void setIssuer (URL issuer) {
562 this.issuer = issuer;
563 }
564
565 public URI getIssuerURI () {
566 return issuerURI;
567 }
568
569 public void setIssuerURI (URI issuerURI) {
570 this.issuerURI = issuerURI;
571 }
572
margaretha19295962018-06-26 16:00:47 +0200573 public JWKSet getPublicKeySet () {
574 return publicKeySet;
575 }
576
margarethad7cab212018-07-02 19:01:43 +0200577 public void setPublicKeySet (String rsaPublic)
578 throws IOException, ParseException {
579 if (rsaPublic == null || rsaPublic.isEmpty()) {
580 return;
581 }
582
583 File rsaPublicFile = new File(rsaPublic);
584 JWKSet jwkSet = null;
585 InputStream is = null;
586 if (rsaPublicFile.exists()) {
587 jwkSet = JWKSet.load(rsaPublicFile);
588 }
589 else if ((is = getClass().getClassLoader()
590 .getResourceAsStream(rsaPublic)) != null) {
591 jwkSet = JWKSet.load(is);
592 }
593 this.publicKeySet = jwkSet;
margaretha19295962018-06-26 16:00:47 +0200594 }
595
596 public RSAPrivateKey getRsaPrivateKey () {
597 return rsaPrivateKey;
598 }
599
margarethad7cab212018-07-02 19:01:43 +0200600 public void setRsaPrivateKey (String rsaPrivate)
601 throws IOException, ParseException, JOSEException {
602 if (rsaPrivate == null || rsaPrivate.isEmpty()) {
603 return;
604 }
605 File rsaPrivateFile = new File(rsaPrivate);
606 String keyString = null;
607 InputStream is = null;
608 if (rsaPrivateFile.exists()) {
609 keyString = IOUtils.readFileToString(rsaPrivateFile,
610 Charset.forName("UTF-8"));
611 }
612 else if ((is = getClass().getClassLoader()
613 .getResourceAsStream(rsaPrivate)) != null) {
614 keyString = IOUtils.readInputStreamToString(is,
615 Charset.forName("UTF-8"));
616 }
617 RSAKey rsaKey = (RSAKey) JWK.parse(keyString);
618 this.rsaPrivateKey = (RSAPrivateKey) rsaKey.toPrivateKey();
margaretha19295962018-06-26 16:00:47 +0200619 }
620
621 public String getRsaKeyId () {
622 return rsaKeyId;
623 }
624
625 public void setRsaKeyId (String rsaKeyId) {
626 this.rsaKeyId = rsaKeyId;
627 }
628
margaretha9c78e1a2018-06-27 14:12:35 +0200629 public OpenIdConfiguration getOpenidConfig () {
630 return openidConfig;
631 }
632
633 public void setOpenidConfig (OpenIdConfiguration openidConfig) {
634 this.openidConfig = openidConfig;
635 }
margaretha064eb6f2018-07-10 18:33:01 +0200636
637 public int getAccessTokenExpiry () {
638 return accessTokenExpiry;
639 }
640
641 public void setAccessTokenExpiry (int accessTokenExpiry) {
642 this.accessTokenExpiry = accessTokenExpiry;
643 }
644
645 public int getRefreshTokenExpiry () {
646 return refreshTokenExpiry;
647 }
648
649 public void setRefreshTokenExpiry (int refreshTokenExpiry) {
650 this.refreshTokenExpiry = refreshTokenExpiry;
651 }
652
653 public int getAuthorizationCodeExpiry () {
654 return authorizationCodeExpiry;
655 }
656
657 public void setAuthorizationCodeExpiry (int authorizationCodeExpiry) {
658 this.authorizationCodeExpiry = authorizationCodeExpiry;
659 }
margaretha33fa3d92018-07-26 13:50:17 +0200660
margaretha1b320452018-08-02 16:56:25 +0200661 public String getNamedVCPath () {
662 return namedVCPath;
663 }
664
665 public void setNamedVCPath (String namedVCPath) {
666 this.namedVCPath = namedVCPath;
667 }
margaretha0afd44a2020-02-05 10:49:21 +0100668
669 public int getAccessTokenLongExpiry () {
670 return accessTokenLongExpiry;
671 }
672
673 public void setAccessTokenLongExpiry (int accessTokenLongExpiry) {
674 this.accessTokenLongExpiry = accessTokenLongExpiry;
675 }
margarethad7163122022-04-11 09:42:41 +0200676
677 public int getRefreshTokenLongExpiry () {
678 return refreshTokenLongExpiry;
679 }
680
681 public void setRefreshTokenLongExpiry (int refreshTokenLongExpiry) {
682 this.refreshTokenLongExpiry = refreshTokenLongExpiry;
683 }
margaretha3181b8d2022-05-31 11:51:47 +0200684
685 public boolean createInitialSuperClient () {
686 return createInitialSuperClient;
687 }
688
689 public void setCreateInitialSuperClient (boolean initialSuperClient) {
690 this.createInitialSuperClient = initialSuperClient;
691 }
margaretha9e73c0e2023-05-05 16:51:49 +0200692
693 public int getMaxNumberOfUserQueries () {
694 return maxNumberOfUserQueries;
695 }
696
697 public void setMaxNumberOfUserQueries (int maxNumberOfUserQueries) {
698 this.maxNumberOfUserQueries = maxNumberOfUserQueries;
699 }
margaretha3181b8d2022-05-31 11:51:47 +0200700
margaretha56e8e552017-12-05 16:31:21 +0100701}