forked from GluuFederation/oxTrust
/
GluuSAMLTrustRelationship.java
451 lines (337 loc) · 12.7 KB
/
GluuSAMLTrustRelationship.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
/*
* oxTrust is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2014, Gluu
*/
package org.gluu.oxtrust.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.gluu.persist.model.base.GluuStatus;
import org.gluu.persist.model.base.InumEntry;
import org.gluu.site.ldap.persistence.annotation.LdapAttribute;
import org.gluu.site.ldap.persistence.annotation.LdapEntry;
import org.gluu.site.ldap.persistence.annotation.LdapObjectClass;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import javax.xml.bind.annotation.XmlTransient;
@LdapEntry
@LdapObjectClass(values = { "top", "gluuSAMLconfig" })
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({GluuEntityType.class, GluuMetadataSourceType.class, GluuStatus.class, GluuValidationStatus.class,
GluuCustomAttribute.class, MetadataFilter.class, ProfileConfiguration.class, DeconstructedTrustRelationship.class})
@JsonInclude(JsonInclude.Include.ALWAYS)
public class GluuSAMLTrustRelationship extends InumEntry implements Serializable {
private static final long serialVersionUID = 5907443836820485369L;
@LdapAttribute(ignoreDuringUpdate = true)
private String inum;
@LdapAttribute(ignoreDuringUpdate = true)
private String iname;
@NotNull
@Size(min = 0, max = 60, message = "Length of the Display Name should not exceed 60")
@LdapAttribute
private String displayName;
@NotNull
@Size(min = 0, max = 4000, message = "Length of the Description should not exceed 4000")
@LdapAttribute
private String description;
@LdapAttribute(name = "gluuStatus")
private GluuStatus status;
@LdapAttribute(name = "gluuValidationStatus")
private GluuValidationStatus validationStatus;
@LdapAttribute(name = "gluuReleasedAttribute")
private List<String> releasedAttributes;
@NotNull
@LdapAttribute(name = "gluuSAMLspMetaDataSourceType")
private GluuMetadataSourceType spMetaDataSourceType;
@LdapAttribute(name = "gluuSAMLspMetaDataFN")
private String spMetaDataFN;
@LdapAttribute(name = "gluuSAMLspMetaDataURL")
private String spMetaDataURL;
@LdapAttribute(name = "o")
private String owner;
@LdapAttribute(name = "gluuSAMLmaxRefreshDelay")
private String maxRefreshDelay;
@Transient
private transient List<GluuCustomAttribute> releasedCustomAttributes = new ArrayList<GluuCustomAttribute>();
private Map<String, MetadataFilter> metadataFilters = new HashMap<String, MetadataFilter>();
private Map<String, ProfileConfiguration> profileConfigurations = new HashMap<String, ProfileConfiguration>();
@LdapAttribute(name = "gluuSAMLMetaDataFilter")
private List<String> gluuSAMLMetaDataFilter;
@LdapAttribute(name = "gluuTrustContact")
private List<String> gluuTrustContact;
private List<DeconstructedTrustRelationship> deconstructedTrustRelationships = new ArrayList<DeconstructedTrustRelationship>();
@LdapAttribute(name = "gluuTrustDeconstruction")
private List<String> gluuTrustDeconstruction;
@LdapAttribute(name = "gluuContainerFederation")
protected String gluuContainerFederation;
@LdapAttribute(name = "gluuIsFederation")
private String gluuIsFederation;
@LdapAttribute(name = "gluuEntityId")
private List<String> gluuEntityId;
@LdapAttribute(name = "gluuProfileConfiguration")
private List<String> gluuProfileConfiguration;
@LdapAttribute(name = "gluuSpecificRelyingPartyConfig")
private String gluuSpecificRelyingPartyConfig;
@Pattern(regexp="^(https?|http)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]", message = "Please enter a valid SP url, including protocol (http/https)")
@LdapAttribute(name = "url")
private String url;
@Pattern(regexp="^$|(^(https?|http)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|])", message = "Please enter a valid url, including protocol (http/https)")
@LdapAttribute(name = "oxAuthPostLogoutRedirectURI")
private String spLogoutURL;
@LdapAttribute(name = "gluuValidationLog")
private List<String> validationLog;
@LdapAttribute(name = "researchAndScholarshipEnabled")
private String researchBundleEnabled;
@LdapAttribute(name = "gluuEntityType")
private GluuEntityType entityType;
public void setFederation(boolean isFederation) {
this.gluuIsFederation = Boolean.toString(isFederation);
}
public boolean isFederation() {
return Boolean.parseBoolean(gluuIsFederation);
}
public void setContainerFederation(GluuSAMLTrustRelationship containerFederation) {
this.gluuContainerFederation = containerFederation.getDn();
}
@Override
public boolean equals(Object o) {
if (!(o instanceof GluuSAMLTrustRelationship)) {
return false;
}
if (getInum() == null) {
return getInum() == ((GluuSAMLTrustRelationship) o).getInum();
}
return getInum().equals(((GluuSAMLTrustRelationship) o).getInum());
}
public List<String> getGluuEntityId() {
return gluuEntityId;
}
@JsonIgnore
@XmlTransient
public void setGluuEntityId(Set<String> gluuEntityId) {
this.gluuEntityId = new ArrayList<String>(gluuEntityId);
}
/*
* This method is for ldap persistance only. For purposes of crud - plea00se use setGluuEntityId(Set<String> gluuEntityId)
*/
@Deprecated
@JsonSetter(nulls = Nulls.AS_EMPTY)
public void setGluuEntityId(List<String> gluuEntityId) {
this.gluuEntityId = gluuEntityId;
}
/*
* This method returns entityId for site TRs only.
*/
public String getEntityId() {
if ((gluuEntityId != null) && (gluuEntityId.size() == 1)) {
return gluuEntityId.get(0);
}
return null;
}
public void setEntityId(String entityId) {
Set<String> entityIds = new TreeSet<String>();
if (entityId != null) {
entityIds.add(entityId);
}
setGluuEntityId(entityIds);
}
public void setSpecificRelyingPartyConfig(boolean specificRelyingPartyConfig) {
this.gluuSpecificRelyingPartyConfig = Boolean.toString(specificRelyingPartyConfig);
}
public boolean getSpecificRelyingPartyConfig() {
return Boolean.parseBoolean(gluuSpecificRelyingPartyConfig);
}
public List<DeconstructedTrustRelationship> getDeconstructedTrustRelationships() {
return deconstructedTrustRelationships;
}
public void setDeconstructedTrustRelationships(List<DeconstructedTrustRelationship> deconstructedTrustRelationships) {
this.deconstructedTrustRelationships = deconstructedTrustRelationships;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getGluuContainerFederation() {
return gluuContainerFederation;
}
public void setGluuContainerFederation(String gluuContainerFederation) {
this.gluuContainerFederation = gluuContainerFederation;
}
public String getGluuIsFederation() {
return gluuIsFederation;
}
public void setGluuIsFederation(String gluuIsFederation) {
this.gluuIsFederation = gluuIsFederation;
}
public List<String> getGluuProfileConfiguration() {
return gluuProfileConfiguration;
}
public void setGluuProfileConfiguration(List<String> gluuProfileConfiguration) {
this.gluuProfileConfiguration = gluuProfileConfiguration;
}
public List<String> getGluuSAMLMetaDataFilter() {
return gluuSAMLMetaDataFilter;
}
public void setGluuSAMLMetaDataFilter(List<String> gluuSAMLMetaDataFilter) {
this.gluuSAMLMetaDataFilter = gluuSAMLMetaDataFilter;
}
public String getGluuSpecificRelyingPartyConfig() {
return gluuSpecificRelyingPartyConfig;
}
public void setGluuSpecificRelyingPartyConfig(String gluuSpecificRelyingPartyConfig) {
this.gluuSpecificRelyingPartyConfig = gluuSpecificRelyingPartyConfig;
}
public List<String> getGluuTrustContact() {
return gluuTrustContact;
}
public void setGluuTrustContact(List<String> gluuTrustContact) {
this.gluuTrustContact = gluuTrustContact;
}
public List<String> getGluuTrustDeconstruction() {
return gluuTrustDeconstruction;
}
public void setGluuTrustDeconstruction(List<String> gluuTrustDeconstruction) {
this.gluuTrustDeconstruction = gluuTrustDeconstruction;
}
public String getIname() {
return iname;
}
public void setIname(String iname) {
this.iname = iname;
}
public String getInum() {
return inum;
}
public void setInum(String inum) {
this.inum = inum;
}
public String getMaxRefreshDelay() {
return maxRefreshDelay;
}
public void setMaxRefreshDelay(String maxRefreshDelay) {
this.maxRefreshDelay = maxRefreshDelay;
}
public Map<String, MetadataFilter> getMetadataFilters() {
return metadataFilters;
}
public void setMetadataFilters(Map<String, MetadataFilter> metadataFilters) {
this.metadataFilters = metadataFilters;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public Map<String, ProfileConfiguration> getProfileConfigurations() {
return profileConfigurations;
}
public void setProfileConfigurations(Map<String, ProfileConfiguration> profileConfigurations) {
this.profileConfigurations = profileConfigurations;
}
public List<String> getReleasedAttributes() {
return releasedAttributes;
}
public void setReleasedAttributes(List<String> releasedAttributes) {
this.releasedAttributes = releasedAttributes;
}
public List<GluuCustomAttribute> getReleasedCustomAttributes() {
return releasedCustomAttributes;
}
public void setReleasedCustomAttributes(List<GluuCustomAttribute> releasedCustomAttributes) {
this.releasedCustomAttributes = releasedCustomAttributes;
}
public String getSpLogoutURL() {
return spLogoutURL;
}
public void setSpLogoutURL(String spLogoutURL) {
this.spLogoutURL = spLogoutURL;
}
public String getSpMetaDataFN() {
return spMetaDataFN;
}
public void setSpMetaDataFN(String spMetaDataFN) {
this.spMetaDataFN = spMetaDataFN;
}
public GluuMetadataSourceType getSpMetaDataSourceType() {
return spMetaDataSourceType;
}
public void setSpMetaDataSourceType(GluuMetadataSourceType spMetaDataSourceType) {
this.spMetaDataSourceType = spMetaDataSourceType;
}
public String getSpMetaDataURL() {
return spMetaDataURL;
}
public void setSpMetaDataURL(String spMetaDataURL) {
this.spMetaDataURL = spMetaDataURL;
}
public GluuStatus getStatus() {
return status;
}
public void setStatus(GluuStatus status) {
this.status = status;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List<String> getValidationLog() {
return validationLog;
}
public void setValidationLog(List<String> validationLog) {
this.validationLog = validationLog;
}
public GluuValidationStatus getValidationStatus() {
return validationStatus;
}
public void setValidationStatus(GluuValidationStatus validationStatus) {
this.validationStatus = validationStatus;
}
public String getResearchBundleEnabled() {
return researchBundleEnabled;
}
public void setResearchBundleEnabled(String researchBundleEnabled) {
this.researchBundleEnabled = researchBundleEnabled;
}
public boolean isResearchBundle() {
return Boolean.parseBoolean(researchBundleEnabled);
}
public boolean getResearchBundle() {
return Boolean.parseBoolean(researchBundleEnabled);
}
public void setResearchBundle(boolean researchBundle) {
this.researchBundleEnabled = Boolean.toString(researchBundle);
}
public GluuEntityType getEntityType() {
return entityType;
}
public void setEntityType(GluuEntityType entityType) {
this.entityType = entityType;
}
}