1
|
|
|
package org.apereo.cas.configuration.model.core.authentication; |
2
|
|
|
|
3
|
|
|
import org.apereo.cas.configuration.support.RequiresModule; |
4
|
|
|
import org.apereo.cas.configuration.support.SpringResourceProperties; |
5
|
|
|
|
6
|
|
|
import java.io.Serializable; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* This is {@link PrincipalTransformationProperties}. |
10
|
|
|
* Transform the user id prior to executing the authentication sequence. |
11
|
|
|
* Each authentication strategy in CAS provides settings to properly transform |
12
|
|
|
* the principal. Refer to the relevant settings for the authentication strategy at hand to learn more. |
13
|
|
|
* |
14
|
|
|
* @author Misagh Moayyed |
15
|
|
|
* @since 5.0.0 |
16
|
|
|
*/ |
17
|
|
|
@RequiresModule(name = "cas-server-core-authentication", automated = true) |
18
|
|
|
public class PrincipalTransformationProperties implements Serializable { |
19
|
|
|
|
20
|
|
|
private static final long serialVersionUID = 1678602647607236322L; |
21
|
|
|
|
22
|
|
|
public enum CaseConversion { |
23
|
|
|
/** |
24
|
|
|
* No conversion. |
25
|
|
|
*/ |
26
|
|
|
NONE, |
27
|
|
|
/** |
28
|
|
|
* Lowercase conversion. |
29
|
|
|
*/ |
30
|
|
|
UPPERCASE, |
31
|
|
|
/** |
32
|
|
|
* Uppcase conversion. |
33
|
|
|
*/ |
34
|
|
|
LOWERCASE, |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Prefix to add to the principal id prior to authentication. |
39
|
|
|
*/ |
40
|
|
|
private String prefix; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Suffix to add to the principal id prior to authentication. |
44
|
|
|
*/ |
45
|
|
|
private String suffix; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* A regular expression that will be used against the provided username |
49
|
|
|
* for username extractions. On a successful match, the first matched group |
50
|
|
|
* in the pattern will be used as the extracted username. |
51
|
|
|
*/ |
52
|
|
|
private String pattern; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Transform usernames using a Groovy resource. |
56
|
|
|
*/ |
57
|
|
|
private Groovy groovy = new Groovy(); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Indicate whether the principal identifier should be transformed |
61
|
|
|
* into upper-case, lower-case, etc. |
62
|
|
|
* Accepted values are {@code NONE, UPPERCASE, LOWERCASE}, |
63
|
|
|
*/ |
64
|
|
|
private CaseConversion caseConversion = CaseConversion.NONE; |
65
|
|
|
|
66
|
|
|
public String getPrefix() { |
67
|
|
|
return prefix; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public void setPrefix(final String prefix) { |
71
|
|
|
this.prefix = prefix; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public String getSuffix() { |
75
|
|
|
return suffix; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public void setSuffix(final String suffix) { |
79
|
|
|
this.suffix = suffix; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public CaseConversion getCaseConversion() { |
83
|
|
|
return caseConversion; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public void setCaseConversion(final CaseConversion caseConversion) { |
87
|
|
|
this.caseConversion = caseConversion; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public String getPattern() { |
91
|
|
|
return pattern; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public void setPattern(final String pattern) { |
95
|
|
|
this.pattern = pattern; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public Groovy getGroovy() { |
99
|
|
|
return groovy; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public void setGroovy(final Groovy groovy) { |
103
|
|
|
this.groovy = groovy; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
@RequiresModule(name = "cas-server-core-authentication", automated = true) |
107
|
|
|
public static class Groovy extends SpringResourceProperties { |
108
|
|
|
private static final long serialVersionUID = 8079027843747126083L; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|