1
|
|
|
package org.apereo.cas.configuration.model.support.spnego; |
2
|
|
|
|
3
|
|
|
import org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties; |
4
|
|
|
import org.apereo.cas.configuration.model.core.authentication.PrincipalTransformationProperties; |
5
|
|
|
import org.apereo.cas.configuration.model.support.ldap.AbstractLdapProperties; |
6
|
|
|
import org.apereo.cas.configuration.support.Beans; |
7
|
|
|
import org.apereo.cas.configuration.support.RequiresModule; |
8
|
|
|
import org.springframework.boot.context.properties.NestedConfigurationProperty; |
9
|
|
|
|
10
|
|
|
import java.io.Serializable; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* This is {@link SpnegoProperties}. |
14
|
|
|
* |
15
|
|
|
* @author Misagh Moayyed |
16
|
|
|
* @since 5.0.0 |
17
|
|
|
*/ |
18
|
|
|
@RequiresModule(name = "cas-server-support-spnego-webflow") |
19
|
|
|
public class SpnegoProperties implements Serializable { |
20
|
|
|
|
21
|
|
|
private static final long serialVersionUID = 8084143496524446970L; |
22
|
|
|
/** |
23
|
|
|
* If specified, will create the principal by ths name on successful authentication. |
24
|
|
|
*/ |
25
|
|
|
private boolean principalWithDomainName; |
26
|
|
|
/** |
27
|
|
|
* Allows authentication if spnego credential is marked as NTLM. |
28
|
|
|
*/ |
29
|
|
|
private boolean ntlmAllowed = true; |
30
|
|
|
/** |
31
|
|
|
* If the authenticated principal cannot be determined from the spegno credential, |
32
|
|
|
* will set the http status code to 401. |
33
|
|
|
*/ |
34
|
|
|
private boolean send401OnAuthenticationFailure = true; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The bean id of a webflow action whose job is to evaluate the client host |
38
|
|
|
* to see if the request is authorized for spnego. |
39
|
|
|
* Supported strategies include {@code hostnameSpnegoClientAction} where |
40
|
|
|
* CAS checks to see if the request’s remote hostname matches a predefine pattern. |
41
|
|
|
* and {@code ldapSpnegoClientAction} where |
42
|
|
|
* CAS checks an LDAP instance for the remote hostname, to locate a pre-defined attribute whose |
43
|
|
|
* mere existence would allow the webflow to resume to SPNEGO. |
44
|
|
|
*/ |
45
|
|
|
private String hostNameClientActionStrategy = "hostnameSpnegoClientAction"; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* LDAP settings for spnego to validate clients, etc. |
49
|
|
|
*/ |
50
|
|
|
private Ldap ldap = new Ldap(); |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The Jcifs password. |
54
|
|
|
*/ |
55
|
|
|
private String jcifsPassword; |
56
|
|
|
/** |
57
|
|
|
* The Jcifs service password. |
58
|
|
|
*/ |
59
|
|
|
private String jcifsServicePassword; |
60
|
|
|
/** |
61
|
|
|
* The Jcifs service principal. |
62
|
|
|
*/ |
63
|
|
|
private String jcifsServicePrincipal = "HTTP/[email protected]"; |
64
|
|
|
/** |
65
|
|
|
* The Kerberos conf. |
66
|
|
|
*/ |
67
|
|
|
private String kerberosConf; |
68
|
|
|
/** |
69
|
|
|
* The Kerberos kdc. |
70
|
|
|
*/ |
71
|
|
|
private String kerberosKdc = "172.10.1.10"; |
72
|
|
|
/** |
73
|
|
|
* The Kerberos realm. |
74
|
|
|
*/ |
75
|
|
|
private String kerberosRealm = "EXAMPLE.COM"; |
76
|
|
|
/** |
77
|
|
|
* The Login conf. |
78
|
|
|
*/ |
79
|
|
|
private String loginConf; |
80
|
|
|
/** |
81
|
|
|
* Spnego JCIFS timeout. |
82
|
|
|
*/ |
83
|
|
|
private String timeout = "PT5M"; |
84
|
|
|
/** |
85
|
|
|
* Jcifs Netbios cache policy. |
86
|
|
|
*/ |
87
|
|
|
private long cachePolicy = 600; |
88
|
|
|
/** |
89
|
|
|
* The Jcifs netbios wins. |
90
|
|
|
*/ |
91
|
|
|
private String jcifsNetbiosWins; |
92
|
|
|
/** |
93
|
|
|
* The Jcifs username. |
94
|
|
|
*/ |
95
|
|
|
private String jcifsUsername; |
96
|
|
|
/** |
97
|
|
|
* The Jcifs domain controller. |
98
|
|
|
*/ |
99
|
|
|
private String jcifsDomainController; |
100
|
|
|
/** |
101
|
|
|
* The Jcifs domain. |
102
|
|
|
*/ |
103
|
|
|
private String jcifsDomain; |
104
|
|
|
/** |
105
|
|
|
* The Kerberos debug. |
106
|
|
|
*/ |
107
|
|
|
private String kerberosDebug; |
108
|
|
|
/** |
109
|
|
|
* The Use subject creds only. |
110
|
|
|
*/ |
111
|
|
|
private boolean useSubjectCredsOnly; |
112
|
|
|
/** |
113
|
|
|
* When validating clients, specifies the DNS timeout used to look up an address. |
114
|
|
|
*/ |
115
|
|
|
private String dnsTimeout = "PT2S"; |
116
|
|
|
/** |
117
|
|
|
* A regex pattern that indicates whether the client host name is allowed for spnego. |
118
|
|
|
*/ |
119
|
|
|
private String hostNamePatternString = ".+"; |
120
|
|
|
/** |
121
|
|
|
* A regex pattern that indicates whether the client IP is allowed for spnego. |
122
|
|
|
*/ |
123
|
|
|
private String ipsToCheckPattern = "127.+"; |
124
|
|
|
/** |
125
|
|
|
* Alternative header name to use in order to find the host address. |
126
|
|
|
*/ |
127
|
|
|
private String alternativeRemoteHostAttribute = "alternateRemoteHeader"; |
128
|
|
|
/** |
129
|
|
|
* In case LDAP is used to validate clients, this is the attribute that indicates the host. |
130
|
|
|
*/ |
131
|
|
|
private String spnegoAttributeName = "distinguishedName"; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Determines the header to set and the message prefix when negotiating spnego. |
135
|
|
|
*/ |
136
|
|
|
private boolean ntlm; |
137
|
|
|
/** |
138
|
|
|
* If true, does not terminate authentication and allows CAS to resume |
139
|
|
|
* and fallback to normal authentication means such as uid/psw via the login page. |
140
|
|
|
* If disallowed, considers spnego authentication to be final in the event of failures. |
141
|
|
|
*/ |
142
|
|
|
private boolean mixedModeAuthentication; |
143
|
|
|
/** |
144
|
|
|
* Begins negotiating spenego if the user-agent is one of the supported browsers. |
145
|
|
|
*/ |
146
|
|
|
private String supportedBrowsers = "MSIE,Trident,Firefox,AppleWebKit"; |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* This is principal transformation properties. |
150
|
|
|
*/ |
151
|
|
|
@NestedConfigurationProperty |
152
|
|
|
private PrincipalTransformationProperties principalTransformation = new PrincipalTransformationProperties(); |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Password encoding settings for this authentication. |
156
|
|
|
*/ |
157
|
|
|
@NestedConfigurationProperty |
158
|
|
|
private PersonDirectoryPrincipalResolverProperties principal = new PersonDirectoryPrincipalResolverProperties(); |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Name of the authentication handler. |
162
|
|
|
*/ |
163
|
|
|
private String name; |
164
|
|
|
|
165
|
|
|
public String getName() { |
166
|
|
|
return name; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public void setName(final String name) { |
170
|
|
|
this.name = name; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
public PrincipalTransformationProperties getPrincipalTransformation() { |
174
|
|
|
return principalTransformation; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public void setPrincipalTransformation(final PrincipalTransformationProperties principalTransformation) { |
178
|
|
|
this.principalTransformation = principalTransformation; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public PersonDirectoryPrincipalResolverProperties getPrincipal() { |
182
|
|
|
return principal; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
public void setPrincipal(final PersonDirectoryPrincipalResolverProperties principal) { |
186
|
|
|
this.principal = principal; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public boolean isSend401OnAuthenticationFailure() { |
190
|
|
|
return send401OnAuthenticationFailure; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public void setSend401OnAuthenticationFailure(final boolean send401OnAuthenticationFailure) { |
194
|
|
|
this.send401OnAuthenticationFailure = send401OnAuthenticationFailure; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
public String getHostNameClientActionStrategy() { |
198
|
|
|
return hostNameClientActionStrategy; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
public void setHostNameClientActionStrategy(final String hostNameClientActionStrategy) { |
202
|
|
|
this.hostNameClientActionStrategy = hostNameClientActionStrategy; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public boolean isNtlm() { |
206
|
|
|
return ntlm; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
public void setNtlm(final boolean ntlm) { |
210
|
|
|
this.ntlm = ntlm; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public boolean isMixedModeAuthentication() { |
214
|
|
|
return mixedModeAuthentication; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
public void setMixedModeAuthentication(final boolean mixedModeAuthentication) { |
218
|
|
|
this.mixedModeAuthentication = mixedModeAuthentication; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
public String getSupportedBrowsers() { |
222
|
|
|
return supportedBrowsers; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
public void setSupportedBrowsers(final String supportedBrowsers) { |
226
|
|
|
this.supportedBrowsers = supportedBrowsers; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
public String getSpnegoAttributeName() { |
230
|
|
|
return spnegoAttributeName; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
public void setSpnegoAttributeName(final String spnegoAttributeName) { |
234
|
|
|
this.spnegoAttributeName = spnegoAttributeName; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
public long getDnsTimeout() { |
238
|
|
|
return Beans.newDuration(dnsTimeout).toMillis(); |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
public void setDnsTimeout(final String dnsTimeout) { |
242
|
|
|
this.dnsTimeout = dnsTimeout; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
public String getIpsToCheckPattern() { |
246
|
|
|
return ipsToCheckPattern; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
public void setIpsToCheckPattern(final String ipsToCheckPattern) { |
250
|
|
|
this.ipsToCheckPattern = ipsToCheckPattern; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public String getAlternativeRemoteHostAttribute() { |
254
|
|
|
return alternativeRemoteHostAttribute; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
public void setAlternativeRemoteHostAttribute(final String alternativeRemoteHostAttribute) { |
258
|
|
|
this.alternativeRemoteHostAttribute = alternativeRemoteHostAttribute; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
public String getJcifsPassword() { |
262
|
|
|
return jcifsPassword; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
public String getHostNamePatternString() { |
266
|
|
|
return hostNamePatternString; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
public void setHostNamePatternString(final String hostNamePatternString) { |
270
|
|
|
this.hostNamePatternString = hostNamePatternString; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
public void setJcifsPassword(final String jcifsPassword) { |
274
|
|
|
this.jcifsPassword = jcifsPassword; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
public String getJcifsServicePassword() { |
278
|
|
|
return jcifsServicePassword; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
public void setJcifsServicePassword(final String jcifsServicePassword) { |
282
|
|
|
this.jcifsServicePassword = jcifsServicePassword; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
public String getJcifsServicePrincipal() { |
286
|
|
|
return jcifsServicePrincipal; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public void setJcifsServicePrincipal(final String jcifsServicePrincipal) { |
290
|
|
|
this.jcifsServicePrincipal = jcifsServicePrincipal; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
public String getKerberosConf() { |
294
|
|
|
return kerberosConf; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
public void setKerberosConf(final String kerberosConf) { |
298
|
|
|
this.kerberosConf = kerberosConf; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
public String getKerberosKdc() { |
302
|
|
|
return kerberosKdc; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
public void setKerberosKdc(final String kerberosKdc) { |
306
|
|
|
this.kerberosKdc = kerberosKdc; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
public String getKerberosRealm() { |
310
|
|
|
return kerberosRealm; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
public void setKerberosRealm(final String kerberosRealm) { |
314
|
|
|
this.kerberosRealm = kerberosRealm; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
public String getLoginConf() { |
318
|
|
|
return loginConf; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
public void setLoginConf(final String loginConf) { |
322
|
|
|
this.loginConf = loginConf; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
public long getTimeout() { |
326
|
|
|
return Beans.newDuration(timeout).toMillis(); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
public void setTimeout(final String timeout) { |
330
|
|
|
this.timeout = timeout; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
public long getCachePolicy() { |
334
|
|
|
return cachePolicy; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
public void setCachePolicy(final long cachePolicy) { |
338
|
|
|
this.cachePolicy = cachePolicy; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
public String getJcifsNetbiosWins() { |
342
|
|
|
return jcifsNetbiosWins; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
public void setJcifsNetbiosWins(final String jcifsNetbiosWins) { |
346
|
|
|
this.jcifsNetbiosWins = jcifsNetbiosWins; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
public String getJcifsUsername() { |
350
|
|
|
return jcifsUsername; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
public void setJcifsUsername(final String jcifsUsername) { |
354
|
|
|
this.jcifsUsername = jcifsUsername; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
public String getJcifsDomainController() { |
358
|
|
|
return jcifsDomainController; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
public void setJcifsDomainController(final String jcifsDomainController) { |
362
|
|
|
this.jcifsDomainController = jcifsDomainController; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
public String getJcifsDomain() { |
366
|
|
|
return jcifsDomain; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
public void setJcifsDomain(final String jcifsDomain) { |
370
|
|
|
this.jcifsDomain = jcifsDomain; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
public String getKerberosDebug() { |
374
|
|
|
return kerberosDebug; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
public void setKerberosDebug(final String kerberosDebug) { |
378
|
|
|
this.kerberosDebug = kerberosDebug; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
public boolean isUseSubjectCredsOnly() { |
382
|
|
|
return useSubjectCredsOnly; |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
public void setUseSubjectCredsOnly(final boolean useSubjectCredsOnly) { |
386
|
|
|
this.useSubjectCredsOnly = useSubjectCredsOnly; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
public boolean isPrincipalWithDomainName() { |
390
|
|
|
return principalWithDomainName; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
public void setPrincipalWithDomainName(final boolean principalWithDomainName) { |
394
|
|
|
this.principalWithDomainName = principalWithDomainName; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
public boolean isNtlmAllowed() { |
398
|
|
|
return ntlmAllowed; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
public void setNtlmAllowed(final boolean ntlmAllowed) { |
402
|
|
|
this.ntlmAllowed = ntlmAllowed; |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
public Ldap getLdap() { |
406
|
|
|
return ldap; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
public void setLdap(final Ldap ldap) { |
410
|
|
|
this.ldap = ldap; |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
public static class Ldap extends AbstractLdapProperties { |
414
|
|
|
private static final long serialVersionUID = -8835216200501334936L; |
415
|
|
|
/** |
416
|
|
|
* LDAP base dn to start the search. |
417
|
|
|
*/ |
418
|
|
|
private String baseDn; |
419
|
|
|
/** |
420
|
|
|
* LDAP search filter to look up hosts. Example: {@code host={host}}. |
421
|
|
|
*/ |
422
|
|
|
private String searchFilter; |
423
|
|
|
|
424
|
|
|
public String getBaseDn() { |
425
|
|
|
return baseDn; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
public void setBaseDn(final String baseDn) { |
429
|
|
|
this.baseDn = baseDn; |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
public String getSearchFilter() { |
433
|
|
|
return searchFilter; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
public void setSearchFilter(final String searchFilter) { |
437
|
|
|
this.searchFilter = searchFilter; |
438
|
|
|
} |
439
|
|
|
} |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
|