/
MetadataConfigurationProperties.java
316 lines (269 loc) · 7.22 KB
/
MetadataConfigurationProperties.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
/*
* Copyright 2023-2024 Sweden Connect
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package se.swedenconnect.spring.saml.idp.autoconfigure.settings;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import org.springframework.core.io.Resource;
import lombok.Data;
import se.swedenconnect.spring.saml.idp.settings.MetadataSettings.ContactPersonType;
/**
* Configuration properties for IdP metadata.
*
* @author Martin Lindström
*/
public class MetadataConfigurationProperties {
/**
* A template for the IdP metadata.
*/
@Setter
@Getter
private Resource template;
/**
* Tells how long the published IdP metadata can remain in a cache.
*/
@Setter
@Getter
private Duration cacheDuration;
/**
* Tells for how long a published metadata entry should be valid.
*/
@Setter
@Getter
private Duration validityPeriod;
/**
* The {@code alg:DigestMethod} elements to include in the metadata.
*/
@Setter
@Getter
private List<String> digestMethods;
/**
* Whether {@code alg:DigestMethod} elements should be placed in an {@code Extensions} element under the role
* descriptor (i.e., the {@code IDPSSODescriptor}). If {@code false}, the {@code alg:DigestMethod} elements are
* included as elements in the {@code Extensions} element of the {@code EntityDescriptor}.
*/
@Setter
@Getter
private boolean includeDigestMethodsUnderRole;
/**
* The {@code alg:SigningMethod} elements to include in the metadata.
*/
@Setter
@Getter
private List<SigningMethod> signingMethods;
/**
* Whether {@code alg:SigningMethod} elements should be placed in an {@code Extensions} element under the role
* descriptor (i.e., the {@code IDPSSODescriptor}). If {@code false}, the {@code alg:SigningMethod} elements are
* included as elements in the {@code Extensions} element of the {@code EntityDescriptor}.
*/
@Setter
@Getter
private boolean includeSigningMethodsUnderRole;
/**
* The {@code md:EncryptionMethod} elements that should be included under the {@code md:KeyDescriptor} for
* the encryption key. Note that these algorithms must match the configured encryption key.
*/
@Setter
@Getter
private List<EncryptionMethod> encryptionMethods;
/**
* The metadata {@code UIInfo} element.
*/
@Setter
@Getter
private UIInfo uiInfo;
/**
* Attribute names that should be included under the {@code RequestedPrincipalSelection} metadata extension.
*/
@Setter
@Getter
private List<String> requestedPrincipalSelection;
/**
* The metadata {@code Organization} element.
*/
@Setter
@Getter
private Organization organization;
/**
* The metadata {@code ContactPerson} elements.
*/
@Setter
@Getter
private Map<ContactPersonType, ContactPerson> contactPersons;
/**
* Settings for {@code alg:SigningMethod} elements.
*
* @author Martin Lindström
*/
public static class SigningMethod {
/**
* Identifies the algorithm by means of the URL defined for its use with the XML Signature specification.
*/
@Setter
@Getter
private String algorithm;
/**
* The smallest key size, in bits, that the entity supports in conjunction with the algorithm. If omitted, no
* minimum is implied.
*/
@Setter
@Getter
private Integer minKeySize;
/**
* The largest key size, in bits, that the entity supports in conjunction with the algorithm. If omitted, no maximum
* is implied.
*/
@Setter
@Getter
private Integer maxKeySize;
}
/**
* Settings for {@code md:EncryptionMethod} elements.
*
* @author Martin Lindström
*/
public static class EncryptionMethod {
/**
* The algorithm URI of the encryption method.
*/
@Setter
@Getter
private String algorithm;
/**
* The key size.
*/
@Setter
@Getter
private Integer keySize;
/**
* The OAEP parameters (in Base64-encoding).
*/
@Setter
@Getter
private String oaepParams;
/**
* If {@code algorithm} indicates a key transport algorithm where the digest algorithm needs to be given,
* this field should be set to this algorithm URI.
*/
@Setter
@Getter
private String digestMethod;
}
/**
* Settings for the metadata {@code UIInfo} element.
*/
public static class UIInfo {
/**
* UIInfo display names. The map key is the language tag and value is display name for that language.
*/
@Setter
@Getter
private Map<String, String> displayNames;
/**
* UIInfo descriptions. The map key is the language tag and value is description for that language.
*/
@Setter
@Getter
private Map<String, String> descriptions;
/**
* UIInfo logotypes.
*/
@Setter
@Getter
private List<Logo> logotypes;
/**
* Representation of a {@code Logo} element.
*/
public static class Logo {
/**
* Logotype URL. Mutually exclusive with path.
*/
@Setter
@Getter
private String url;
/**
* Logotype path. Mutually exclusive with url.
*/
@Setter
@Getter
private String path;
/**
* Logotype height in pixels.
*/
@Setter
@Getter
private Integer height;
/**
* Logotype width in pixels.
*/
@Setter
@Getter
private Integer width;
/**
* Logotype language tag.
*/
@Setter
@Getter
private String languageTag;
}
}
/**
* Settings for the {@code Organization} metadata element.
*/
@Data
public static class Organization {
/**
* The {@code OrganizationName}. The map key is the language tag and value is display name for that language.
*/
private Map<String, String> names;
/**
* The {@code OrganizationDisplayName}. The map key is the language tag and value is display name for that language.
*/
private Map<String, String> displayNames;
/**
* The {@code OrganizationURL}. The map key is the language tag and value is display name for that language.
*/
private Map<String, String> urls;
}
/**
* Settings for the {@code ContactPerson} metadata element.
*/
@Data
public static class ContactPerson {
/**
* The {@code Company} element.
*/
private String company;
/**
* The {@code GivenName} element.
*/
private String givenName;
/**
* The {@code SurName} element.
*/
private String surname;
/**
* The {@code EmailAddress} elements.
*/
private List<String> emailAddresses;
/**
* The {@code TelephoneNumber} elements.
*/
private List<String> telephoneNumbers;
}
}