1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.sra;
20
21 import java.io.Serializable;
22 import java.net.URI;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.List;
26 import org.apache.syncope.common.lib.SyncopeProperties;
27 import org.apache.syncope.common.lib.types.SAML2BindingType;
28 import org.jasig.cas.client.Protocol;
29 import org.springframework.boot.context.properties.ConfigurationProperties;
30 import org.springframework.security.oauth2.core.oidc.OidcScopes;
31
32 @ConfigurationProperties(SRAProperties.PREFIX)
33 public class SRAProperties extends SyncopeProperties {
34
35 private static final long serialVersionUID = 1250377680268118123L;
36
37 public static final String PREFIX = "sra";
38
39 public static final String AM_TYPE = "am-type";
40
41 public static class Global implements Serializable {
42
43 private static final long serialVersionUID = -2035267979830256742L;
44
45 private URI error = URI.create("/error");
46
47 private URI postLogout = URI.create("/logout");
48
49 public URI getError() {
50 return error;
51 }
52
53 public void setError(final URI error) {
54 this.error = error;
55 }
56
57 public URI getPostLogout() {
58 return postLogout;
59 }
60
61 public void setPostLogout(final URI postLogout) {
62 this.postLogout = postLogout;
63 }
64 }
65
66 public enum AMType {
67 OIDC,
68 OAUTH2,
69 SAML2,
70 CAS
71
72 }
73
74 public static class OIDC implements Serializable {
75
76 private static final long serialVersionUID = 4428057402762583676L;
77
78 private String configuration;
79
80 private String clientId;
81
82 private String clientSecret;
83
84 private List<String> scopes = Arrays.asList(
85 OidcScopes.OPENID,
86 OidcScopes.ADDRESS,
87 OidcScopes.EMAIL,
88 OidcScopes.PHONE,
89 OidcScopes.PROFILE);
90
91 public String getConfiguration() {
92 return configuration;
93 }
94
95 public void setConfiguration(final String configuration) {
96 this.configuration = configuration;
97 }
98
99 public String getClientId() {
100 return clientId;
101 }
102
103 public void setClientId(final String clientId) {
104 this.clientId = clientId;
105 }
106
107 public String getClientSecret() {
108 return clientSecret;
109 }
110
111 public void setClientSecret(final String clientSecret) {
112 this.clientSecret = clientSecret;
113 }
114
115 public List<String> getScopes() {
116 return scopes;
117 }
118
119 public void setScopes(final List<String> scopes) {
120 this.scopes = scopes;
121 }
122 }
123
124 public static class OAUTH2 implements Serializable {
125
126 private static final long serialVersionUID = -5051777207539192764L;
127
128 private String tokenUri;
129
130 private String authorizationUri;
131
132 private String userInfoUri;
133
134 private String userNameAttributeName;
135
136 private String jwkSetUri;
137
138 private String issuer;
139
140 private String clientId;
141
142 private String clientSecret;
143
144 private List<String> scopes = new ArrayList<>();
145
146 public String getTokenUri() {
147 return tokenUri;
148 }
149
150 public void setTokenUri(final String tokenUri) {
151 this.tokenUri = tokenUri;
152 }
153
154 public String getAuthorizationUri() {
155 return authorizationUri;
156 }
157
158 public void setAuthorizationUri(final String authorizationUri) {
159 this.authorizationUri = authorizationUri;
160 }
161
162 public String getUserInfoUri() {
163 return userInfoUri;
164 }
165
166 public void setUserInfoUri(final String userInfoUri) {
167 this.userInfoUri = userInfoUri;
168 }
169
170 public String getUserNameAttributeName() {
171 return userNameAttributeName;
172 }
173
174 public void setUserNameAttributeName(final String userNameAttributeName) {
175 this.userNameAttributeName = userNameAttributeName;
176 }
177
178 public String getJwkSetUri() {
179 return jwkSetUri;
180 }
181
182 public void setJwkSetUri(final String jwkSetUri) {
183 this.jwkSetUri = jwkSetUri;
184 }
185
186 public String getIssuer() {
187 return issuer;
188 }
189
190 public void setIssuer(final String issuer) {
191 this.issuer = issuer;
192 }
193
194 public String getClientId() {
195 return clientId;
196 }
197
198 public void setClientId(final String clientId) {
199 this.clientId = clientId;
200 }
201
202 public String getClientSecret() {
203 return clientSecret;
204 }
205
206 public void setClientSecret(final String clientSecret) {
207 this.clientSecret = clientSecret;
208 }
209
210 public List<String> getScopes() {
211 return scopes;
212 }
213
214 public void setScopes(final List<String> scopes) {
215 this.scopes = scopes;
216 }
217 }
218
219 public static class SAML2 implements Serializable {
220
221 private static final long serialVersionUID = 6819907914821190235L;
222
223 private SAML2BindingType authnRequestBinding = SAML2BindingType.POST;
224
225 private SAML2BindingType logoutRequestBinding = SAML2BindingType.POST;
226
227 private SAML2BindingType logoutResponseBinding = SAML2BindingType.REDIRECT;
228
229 private String entityId;
230
231 private long maximumAuthenticationLifetime = 3600;
232
233 private long acceptedSkew = 300;
234
235 private String spMetadataFilePath;
236
237 private String idpMetadata;
238
239 private String keystore;
240
241 private String keystoreType;
242
243 private String keystoreStorepass;
244
245 private String keystoreKeypass;
246
247 public SAML2BindingType getAuthnRequestBinding() {
248 return authnRequestBinding;
249 }
250
251 public void setAuthnRequestBinding(final SAML2BindingType authnRequestBinding) {
252 this.authnRequestBinding = authnRequestBinding;
253 }
254
255 public SAML2BindingType getLogoutRequestBinding() {
256 return logoutRequestBinding;
257 }
258
259 public void setLogoutRequestBinding(final SAML2BindingType logoutRequestBinding) {
260 this.logoutRequestBinding = logoutRequestBinding;
261 }
262
263 public SAML2BindingType getLogoutResponseBinding() {
264 return logoutResponseBinding;
265 }
266
267 public void setLogoutResponseBinding(final SAML2BindingType logoutResponseBinding) {
268 this.logoutResponseBinding = logoutResponseBinding;
269 }
270
271 public String getEntityId() {
272 return entityId;
273 }
274
275 public void setEntityId(final String entityId) {
276 this.entityId = entityId;
277 }
278
279 public long getMaximumAuthenticationLifetime() {
280 return maximumAuthenticationLifetime;
281 }
282
283 public void setMaximumAuthenticationLifetime(final long maximumAuthenticationLifetime) {
284 this.maximumAuthenticationLifetime = maximumAuthenticationLifetime;
285 }
286
287 public long getAcceptedSkew() {
288 return acceptedSkew;
289 }
290
291 public void setAcceptedSkew(final int acceptedSkew) {
292 this.acceptedSkew = acceptedSkew;
293 }
294
295 public String getSpMetadataFilePath() {
296 return spMetadataFilePath;
297 }
298
299 public void setSpMetadataFilePath(final String spMetadataFilePath) {
300 this.spMetadataFilePath = spMetadataFilePath;
301 }
302
303 public String getIdpMetadata() {
304 return idpMetadata;
305 }
306
307 public void setIdpMetadata(final String idpMetadata) {
308 this.idpMetadata = idpMetadata;
309 }
310
311 public String getKeystore() {
312 return keystore;
313 }
314
315 public void setKeystore(final String keystore) {
316 this.keystore = keystore;
317 }
318
319 public String getKeystoreType() {
320 return keystoreType;
321 }
322
323 public void setKeystoreType(final String keystoreType) {
324 this.keystoreType = keystoreType;
325 }
326
327 public String getKeystoreStorePass() {
328 return keystoreStorepass;
329 }
330
331 public void setKeystoreStorePass(final String keystoreStorePass) {
332 this.keystoreStorepass = keystoreStorePass;
333 }
334
335 public String getKeystoreKeypass() {
336 return keystoreKeypass;
337 }
338
339 public void setKeystoreKeypass(final String keystoreKeyPass) {
340 this.keystoreKeypass = keystoreKeyPass;
341 }
342 }
343
344 public static class CAS implements Serializable {
345
346 private static final long serialVersionUID = -5413988649759834473L;
347
348 private String serverPrefix;
349
350 private Protocol protocol = Protocol.CAS3;
351
352 public String getServerPrefix() {
353 return serverPrefix;
354 }
355
356 public void setServerPrefix(final String serverPrefix) {
357 this.serverPrefix = serverPrefix;
358 }
359
360 public Protocol getProtocol() {
361 return protocol;
362 }
363
364 public void setProtocol(final Protocol protocol) {
365 this.protocol = protocol;
366 }
367 }
368
369 private final Global global = new Global();
370
371 private AMType amType = AMType.OIDC;
372
373 private final OIDC oidc = new OIDC();
374
375 private final OAUTH2 oauth2 = new OAUTH2();
376
377 private final SAML2 saml2 = new SAML2();
378
379 private final CAS cas = new CAS();
380
381 public Global getGlobal() {
382 return global;
383 }
384
385 public AMType getAmType() {
386 return amType;
387 }
388
389 public void setAmType(final AMType amType) {
390 this.amType = amType;
391 }
392
393 public OIDC getOidc() {
394 return oidc;
395 }
396
397 public OAUTH2 getOauth2() {
398 return oauth2;
399 }
400
401 public SAML2 getSaml2() {
402 return saml2;
403 }
404
405 public CAS getCas() {
406 return cas;
407 }
408 }